home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d17 / pgraf110.arc / PGRAPH.DOC < prev    next >
Text File  |  1991-06-21  |  104KB  |  2,679 lines

  1.  
  2.                             PGRAPH Version 1.10
  3.  
  4.                   An MS-DOS C Standard Printer Interface
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20. Written and Distributed by:
  21.  
  22. Frank van der Hulst,
  23. 101 Epuni St,
  24. Lower Hutt,
  25. New Zealand
  26.  
  27. Electronic mail to:
  28. UseNet:   frank@cavebbs.gen.nz
  29. FidoNet:  frank vanderhulst at GenBoard (Node 3:771/160)
  30.  
  31. Phone (Voice):      0064 4 693-481
  32.  
  33. 20 June 1991
  34.  
  35.  
  36. ───────────────────────────────────────────────────────────────────────────
  37.  
  38. Program and Documentation Copyright Frank van der Hulst, 1991
  39. All rights reserved
  40.  
  41. Portions Copyright 1987, 1989 Borland International.
  42. Portions Copyright Microsoft Corporation.
  43.  
  44. PC-DOS, PC, PC XT, PC AT, and PS/2 are trademarks of IBM Corporation.
  45. MS-DOS, OS/2, and Windows are trademarks of Microsoft Corporation.
  46.  
  47. No part of this document may be reproduced, stored in a retrieval system,
  48. or transcribed, in any form or by any means, electronic, mechanical,
  49. photocopying, recording, scanning or otherwise, other than as stated in the
  50. license agreement, without the prior permission of:
  51.  
  52. Frank van der Hulst,
  53. 101 Epuni St,
  54. Lower Hutt,
  55. New Zealand
  56.  
  57. ───────────────────────────────────────────────────────────────────────────
  58.  
  59.  
  60.  
  61. PGRAPH Printer Graphics Library                                     Page i.
  62.  
  63.  
  64.  
  65.                              TABLE OF CONTENTS
  66.  
  67. Introduction..............................................................1
  68.  
  69. Registration Information..................................................1
  70.  
  71. PGRAPH License Agreement..................................................2
  72. Shareware Version:........................................................2
  73. Registered Version:.......................................................3
  74. Source Code Version:......................................................3
  75.  
  76. DISCLAIMER................................................................4
  77.  
  78. Technical Support.........................................................4
  79.  
  80. PGRAPH Features...........................................................5
  81. Minimal Program Size......................................................5
  82. Video Support.............................................................5
  83. Printer Support...........................................................5
  84. Networks..................................................................5
  85. Planned Improvements......................................................5
  86.  
  87. PGRAPH Files..............................................................6
  88. Test Driving PGRAPH.......................................................7
  89. Using PGRAPH in your own programs.........................................8
  90. Limitations and variations from GRAPHICS.LIB..............................9
  91.  
  92. PGRAPH Function Reference................................................11
  93. p_arc....................................................................12
  94. p_bar....................................................................12
  95. p_bar3d..................................................................12
  96. p_circle.................................................................13
  97. p_cleardevice............................................................13
  98. p_clearviewport..........................................................13
  99. p_closegraph.............................................................13
  100. p_drawpoly...............................................................14
  101. p_dump...................................................................14
  102. p_ellipse................................................................14
  103. p_fillellipse............................................................14
  104. p_fillpoly...............................................................15
  105. p_floodfill..............................................................15
  106. p_getarccoords...........................................................15
  107. p_getaspectratio.........................................................15
  108. p_getcolor...............................................................16
  109. p_getdrivername..........................................................16
  110. p_getfillpattern.........................................................16
  111. p_getfillsettings........................................................16
  112. p_getgraphmode...........................................................16
  113. p_getimage...............................................................17
  114. p_getlinesettings........................................................17
  115. p_getmaxcolor............................................................17
  116. p_getmaxmode.............................................................17
  117. p_getmaxx................................................................17
  118. p_getmaxy................................................................17
  119. p_getmodename............................................................18
  120. p_getmoderange...........................................................18
  121.  
  122.  
  123. Copyright - Frank van der Hulst/1991
  124. PGRAPH Printer Graphics Library                                    Page ii.
  125.  
  126.  
  127. p_getpixel...............................................................18
  128. p_getresolution..........................................................18
  129. p_gettextsettings........................................................18
  130. p_getx...................................................................18
  131. p_gety...................................................................19
  132. p_graphdefaults..........................................................19
  133. _p_graphfreemem..........................................................19
  134. _p_graphgetmem...........................................................20
  135. p_graphresult............................................................20
  136. p_imagesize..............................................................21
  137. p_initgraph..............................................................21
  138. p_line...................................................................22
  139. p_linerel................................................................22
  140. p_lineto.................................................................22
  141. p_moverel................................................................23
  142. p_moveto.................................................................23
  143. p_outtext................................................................23
  144. p_outtextxy..............................................................23
  145. p_pieslice...............................................................23
  146. p_print..................................................................24
  147. p_putimage...............................................................24
  148. p_putpixel...............................................................25
  149. _p_putpixel_screen.......................................................25
  150. p_rectangle..............................................................25
  151. p_registerbgidriver......................................................26
  152. p_registerbgifont........................................................26
  153. p_registerfarbgidriver...................................................26
  154. p_registerfarbgifont.....................................................26
  155. p_sector.................................................................27
  156. p_setaspectratio.........................................................27
  157. p_setcolor...............................................................27
  158. p_setfillpattern.........................................................27
  159. p_setfillstyle...........................................................28
  160. p_setgraphmode...........................................................28
  161. p_setlinestyle...........................................................29
  162. p_settextjustify.........................................................29
  163. p_settextstyle...........................................................30
  164. p_setusercharsize........................................................31
  165. p_setviewport............................................................31
  166. p_setwritemode...........................................................32
  167. p_textheight.............................................................32
  168. p_textwidth..............................................................32
  169. p_view...................................................................32
  170.  
  171. MAKING A .PGI FILE.......................................................33
  172. Printer Description......................................................33
  173. Graphics Modes Descriptions..............................................34
  174.  
  175. REVISION HISTORY.........................................................38
  176.  
  177. Index....................................................................39
  178.  
  179.  
  180.  
  181.  
  182.  
  183. Copyright - Frank van der Hulst/1991
  184. PGRAPH Printer Graphics Library                                     Page 1.
  185.  
  186.  
  187.  
  188. Introduction
  189.  
  190. If you're tired of re-writing your programs for the various printers
  191. available, you'll love PGRAPH!
  192.  
  193. PGRAPH is a library of C functions designed to allow you to print graphics
  194. as easily as you can display them on the screen of your IBM PC or
  195. compatible system. It provides a BGI-like (Borland Graphics Interface) to
  196. your printer.
  197.  
  198. PGRAPH is a library of graphics routines, similar to those provided by
  199. Borland in GRAPHICS.LIB. As such, it is a programmer's toolkit, and is not
  200. designed for the end-user. It allows you to print any graphic image,
  201. including Borland's stroked fonts, on a wide range of printers.
  202.  
  203. These functions take the same number and type of parameters as the Borland
  204. functions, so that it is a simple matter to "redirect" graphics output from
  205. the screen to your printer.
  206.  
  207. A cut-down version of PGRAPH is distributed as shareware, so that you can
  208. try it out before you decide whether you'd like to buy the full version.
  209. The complete version is available only from the author, on payment of a
  210. registration fee.
  211.  
  212. The following pages include information on registration, the PGRAPH license
  213. agreement, and technical support for PGRAPH.
  214.  
  215. Currently, there is no printed manual. Registered users get a copy of this
  216. file, formatted and ready to print on a LaserJet III, or in XyWrite format.
  217. If there should be sufficient demand, a printed version may be
  218. commissioned.
  219.  
  220. Registration Information
  221.  
  222. PGRAPH is a copyrighted program protected by both N.Z. and international
  223. copyright law. If you obtained PGRAPH from a shareware disk vendor, an on-
  224. line computer service or bulletin board, a friend or colleague, or another
  225. similar source, you have an unregistered (trial) copy. You are authorized
  226. to use this copy without charge for a limited period of time under the
  227. terms of the PGRAPH license agreement. After this time is up, you must
  228. register and pay for PGRAPH to continue using it.
  229.  
  230. This method of distribution is known as shareware. It allows you to
  231. determine whether PGRAPH meets your needs before you pay for it.
  232.  
  233. The registration fee for a single copy of PGRAPH is NZ$75. This is
  234. approximately US$50 at current exchange rates. Payment of this fee entitles
  235. you to:
  236.  
  237. *    A copy of PGRAPH, registered to you. This may be delivered either via
  238.      a diskette, or via E-mail.
  239.  
  240. *    An upgrade to the next major release of PGRAPH. Upgrades may be
  241.      delivered either via E-mail, or on diskette. If you need an upgrade on
  242.      diskette there will be a minimal processing charge to cover my costs
  243.      in sending it to you.
  244.  
  245. *    Technical support via electronic mail or telephone.
  246.  
  247.  
  248. Copyright - Frank van der Hulst/1991
  249. PGRAPH Printer Graphics Library                                     Page 2.
  250.  
  251.  
  252.  
  253. Network, site, and corporate licenses are also available; contact the
  254. author for more information.
  255.  
  256. Source code is available at a price of NZ$125 (approximately US$100).
  257.  
  258. Please make payment by transferring the correct amount to my bank account
  259. (number 060529-0320661-00) at the Lower Hutt branch of the National Bank of
  260. New Zealand.
  261.  
  262.  
  263. PGRAPH License Agreement
  264.  
  265. The PGRAPH library and all programs and documentation distributed or
  266. shipped with it are Copyright Frank van der Hulst, 1991, and are protected
  267. by N.Z. and International copyright law. In the rest of this document, this
  268. collection of files is referred to simply as "PGRAPH". You are granted a
  269. license to use your copy of PGRAPH only under the terms and conditions
  270. specified in this license agreement.
  271.  
  272. PGRAPH is distributed in three forms:
  273.  
  274. *    A "shareware" copy of PGRAPH is a copy distributed on diskette or via
  275.      an electronic bulletin board, on-line service, or other electronic
  276.      means, obtained from a shareware disk vendor, or obtained from another
  277.      individual, and which displays the legend "shareware" on the diskette
  278.      label (if applicable). On it, the library files are called
  279.      PGRAPHTT.LIB and PGRAPHLM.LIB.
  280.  
  281. *    A "registered" copy of the PGRAPH library is a copy distributed on
  282.      diskette or via electronic mail, purchased from F van der Hulst. It
  283.      includes library files for all memory models, for either the Turbo-C
  284.      or the MS-C compiler.
  285.  
  286. *    A "source code" copy of the PGRAPH library is a copy distributed on
  287.      diskette or via electronic mail, purchased from F van der Hulst. It
  288.      includes C and Assembler source code for all of the functions in the
  289.      PGRAPH library, and utilities associated with it.
  290.  
  291. "Printer Graphics Interface" files (with a .PGI extension), whether
  292. included in the package or developed by the user, may be freely
  293. distributed.
  294.  
  295.  
  296. Different conditions apply to the three versions, as follows:
  297.  
  298. Shareware Version:
  299.  
  300. Shareware copies of PGRAPH are distributed to allow you to try the program
  301. before you pay for it. They are not "free" or "public domain" software. You
  302. may use PGR_TCSH.LIB or PGR_MSSH at no charge for a trial period of up to
  303. 21 days. If you wish to continue using PGRAPH after that period, you must
  304. purchase a registered copy. If you choose not to purchase a registered
  305. copy, you must stop using PGRAPH, though you may keep copies and pass them
  306. along to others.
  307.  
  308.  
  309.  
  310. Copyright - Frank van der Hulst/1991
  311. PGRAPH Printer Graphics Library                                     Page 3.
  312.  
  313.  
  314. This document, the shareware versions of the library (PGRAPHTT.LIB and
  315. PGRAPHLM.LIB), and the associated header file may be freely copied provided
  316. that:
  317.  
  318.      All of the files are copied as a group (such as in a single archive).
  319.      See below for a list of files.
  320.  
  321.      The files are not modified in any way (including removal or
  322.      alteration of copyright notices or this license).
  323.  
  324.      No charge beyond a cost-recovery fee not to exceed $5 is made.
  325.  
  326. You may NOT distribute any program which includes code derived from the
  327. shareware version of the package.
  328.  
  329. Registered Version:
  330.  
  331. Registered copies of PGRAPH are distributed to those who have purchased
  332. them. Just like Borland's No-Nonsense License Agreement, you may install
  333. PGRAPH on many computers, so long as only one version can be used at a
  334. time. The same applies to networks.
  335.  
  336. You may copy the registered version of PGRAPH for normal backup purposes.
  337.  
  338. This registration license may NOT be transferred to any other person or
  339. organisation without the permission of F van der Hulst.
  340.  
  341. Programs created using PGRAPH should include the following acknowledgement
  342. in their documentation:
  343.  
  344. "This program uses the PGRAPH printer graphics package developed by F van
  345. der Hulst, Wellington, New Zealand".
  346.  
  347. If you are dissatisfied with a registered copy of PGRAPH for any reason,
  348. you may erase your copy of PGRAPH from your system (and if applicable,
  349. return the diskette) at any time up to 90 days after purchase and receive a
  350. full refund of your original registration fee.
  351.  
  352. Registered users get a copy of this documentation file, formatted and ready
  353. to print on a LaserJet III, or in a word processor format of their choice
  354. (where possible).
  355.  
  356. Source Code Version:
  357.  
  358. Source Code copies of PGRAPH are distributed to those who have purchased
  359. them. Just like Borland's No-Nonsense License Agreement, you may install
  360. PGRAPH on many computers, so long as only one version can be used at a
  361. time. The same applies to networks.
  362.  
  363. You may copy the source code version of PGRAPH for normal backup purposes.
  364.  
  365. This registration license may NOT be transferred to any other person or
  366. organisation without the permission of F van der Hulst.
  367.  
  368. Source code derived from the PGRAPH package may not be distributed in any
  369. way without the permission of F van der Hulst.
  370.  
  371.  
  372.  
  373. Copyright - Frank van der Hulst/1991
  374. PGRAPH Printer Graphics Library                                     Page 4.
  375.  
  376.  
  377. Programs created using PGRAPH should include the following acknowledgement
  378. in their documentation:
  379.  
  380. "This program uses code derived from the PGRAPH printer graphics package
  381. developed by F van der Hulst, Wellington, New Zealand".
  382.  
  383. If you are dissatisfied with a registered copy of PGRAPH for any reason,
  384. you may erase your copy of PGRAPH from your system (and if applicable,
  385. return the diskette) at any time up to 90 days after purchase and receive a
  386. full refund of your original registration fee.
  387.  
  388. Registered users get a copy of this documentation file, formatted and ready
  389. to print on a LaserJet III, or in a word processor format of their choice
  390. (where possible).
  391.  
  392.  
  393. DISCLAIMER
  394.  
  395. Although I have tested the code which comprises PGRAPH it is entirely
  396. possible that PGRAPH may malfunction in environments or under circumstances
  397. in which it has not been tested. This code is provided AS IS, and the
  398. author disclaims any and all responsibility for damages (both consequential
  399. and incidental) resulting from the use or misuse of PGRAPH. Sole
  400. responsibility for determining the suitability of the code rests with the
  401. user.
  402.  
  403.  
  404. Technical Support
  405.  
  406. Full technical support for PGRAPH is available only to registered users. If
  407. you are not a registered user, support is limited to assistance with the
  408. installation of a shareware copy of PGRAPH for a 21 day evaluation period.
  409.  
  410. The best way to contact me for support is via Electronic Mail, preferably
  411. via UseNet. Generally, a message will be acknowledged within one day of
  412. receipt. There will obviously be some delay, involved in transmitting a
  413. message through a network.
  414.  
  415. Bulletin Boards: Primary support is via the "Local Software" Forum (Area 4)
  416. of Genboard BBS, Wellington, NZ 0064 4 499-0490. Genboard is attached to
  417. the FidoNet BBS Network as Node 3:771/160. You may expect a response within
  418. 3-5 days. Please note that Genboard is an independent bulletin board which
  419. has agreed to serve as a home base for PGRAPH support, but is not owned or
  420. operated by me.
  421.  
  422. In addition, registered users may contact me for support by mail, or
  423. telephone. My address and phone number are listed on the first page of this
  424. manual.
  425.  
  426. I prefer support via one of the electronic services listed above, or via
  427. electronic mail, as it allows correspondence at convenient times regardless
  428. of time zones and work schedules, and it provides a record of the
  429. communication. However, telephone support is also provided to those users
  430. who do not have a modem and need a quick response. Please check what time
  431. it is in New Zealand (usually 12 hours ahead of GMT) before you call. In
  432. general, support is only available between 5pm and 10pm NZ time.
  433.  
  434.  
  435.  
  436. Copyright - Frank van der Hulst/1991
  437. PGRAPH Printer Graphics Library                                     Page 5.
  438.  
  439.  
  440.  
  441. PGRAPH Features
  442.  
  443. PGRAPH is written for the IBM PC, PC/XT, PC/AT, PS/2 (all models), and
  444. compatibles. It was developed using Turbo C v2.01. Libraries are provided
  445. for Turbo C v2.01 and Microsoft C v5.10.
  446.  
  447. PGRAPH.LIB is a library of graphics routines, similar to those provided by
  448. Borland in GRAPHICS.LIB. These functions perform similar  tasks to, and
  449. take the same number and type of parameters as, the Borland functions.
  450.  
  451. This library contains code which is really only useful with Turbo C or MS
  452. C, since it calls routines which are located in the vendor's libraries. It
  453. is my intention to release versions for other C compilers in the future.
  454.  
  455.  
  456. Minimal Program Size
  457.  
  458. PGRAPH is split up into several small modules, so that only the required
  459. modules are linked to the executable program.
  460.  
  461. Video Support
  462.  
  463. PGRAPH allows the program to simultaneously output the image being printed
  464. to the video screen by using a user-provided pixel-display routine.
  465.  
  466. Printer Support
  467.  
  468. This version of PGRAPH includes drivers for the following printers:
  469.  
  470.      HP LaserJet    (series II or III)
  471.      Epson LX-400
  472.      Star NX-10
  473.  
  474. These last two are 9-pin dot-matrix printers, and support modes available
  475. on almost any "IBM Graphics Printer"-compatible printer.
  476.  
  477. Adding support for new printers is a simple process.
  478.  
  479. Networks
  480.  
  481. PGRAPH outputs to the printer by printing to stdprn, and works successfully
  482. with programs which redirect printer output. This includes networks such as
  483. Novell Netware. Output can also be redirected to other devices such as disk
  484. files from within the user program.
  485.  
  486.  
  487. Planned Improvements
  488.  
  489. Improvements will depend on registrations. If no-one registers, I'm not
  490. going to spend any more of my time on this package.
  491.  
  492. *    Make the library compiler & memory model independent.
  493.  
  494. *    Use XMS/EMS/Disk for memory buffers.
  495.  
  496. *    Create a Turbo Pascal .TPU unit which links to the C code.
  497.  
  498.  
  499. Copyright - Frank van der Hulst/1991
  500. PGRAPH Printer Graphics Library                                     Page 6.
  501.  
  502.  
  503.  
  504. *    Support for colour printers, including allowing the programmer to set
  505.      the palette and background colour.
  506.  
  507. *    Closer integration into Borland's BGI system, including putting code
  508.      into the PGI driver file. This will allow support for plotters, and
  509.      use of (for example) the line drawing features available on the
  510.      LaserJet III.
  511.  
  512. *    Fix the bug in calculating start and end-points of arcs.
  513.  
  514. *    Fix the problem with drawing thick lines in XOR mode.
  515.  
  516. I welcome feedback on the above, and suggestions of other improvements.
  517.  
  518.  
  519. PGRAPH Files
  520.  
  521. The files listed below are part of PGRAPH. Depending on where you obtained
  522. your copy, you may find the files in a compressed form, usually in a file
  523. with the extension .ZIP. These files may change from time to time. See the
  524. file README.DOC for up to date information on which files are included with
  525. your copy of PGRAPH.
  526.  
  527. PGRAPHTT.LIB        The PGRAPH library for Tiny model Turbo C.
  528.  
  529. PGRAPHLM.LIB        The PGRAPH library for Large model MS C.
  530.  
  531. PGRAPH.H            The PGRAPH header file. This includes all the
  532.                     prototypes which allow your compiler to check that
  533.                     calls to the library are correct.
  534.  
  535. *.PGI               These files contain the interface information required
  536.                     for various printers.
  537.  
  538. *.OBJ               .PGI files converted to .OBJ, so that the drivers can
  539.                     be linked into the executable program.
  540.  
  541. MAKE_PGI.EXE        A program which allows you to create a new .PGI file.
  542.  
  543. PGRAPH.DOC          The PGRAPH manual.
  544.  
  545. DEMO.EXE            A demonstration program, created with the Medium memory
  546.                     model PGRAPH library, which demonstrates various
  547.                     features of the package.
  548.  
  549. DEMO.C              Main program source code for the above program. You
  550.                     will NOT be able to compile and link this unless you
  551.                     have the registered version.
  552.  
  553. DEMO_SUB.C          Subprograms for various demonstrations to link with
  554.                     DEMO.C.
  555.  
  556. DEMO.PRJ            Turbo C v2.0 project file used to create DEMO.EXE
  557.  
  558. DEMO_CFG.TC         Turbo C v2.0 IDE configuration file to create DEMO.EXE
  559.  
  560.  
  561.  
  562. Copyright - Frank van der Hulst/1991
  563. PGRAPH Printer Graphics Library                                     Page 7.
  564.  
  565.  
  566. MAKE.MSC            Microsoft C MAKE file used to create DEMO.EXE
  567.  
  568. README.DOC          Last-minute revisions and bug reports.
  569.  
  570. In addition, the registered version of PGRAPH includes the following:
  571.  
  572. PGRAPHT?.LIB        The PGRAPH library for Tiny model.
  573. PGRAPHS?.LIB        The PGRAPH library for Small model.
  574. PGRAPHM?.LIB        The PGRAPH library for Medium model.
  575. PGRAPHC?.LIB        The PGRAPH library for Compact model.
  576. PGRAPHL?.LIB        The PGRAPH library for Large model.
  577. PGRAPHH?.LIB        The PGRAPH library for Huge model.
  578.  
  579.                     The last character of the filename will be either an M
  580.                     or a T, depending on whether they order the MicroSoft
  581.                     or Turbo C version.
  582.  
  583. BIN_ASM.C           A program to convert a .PGI file to an assembler source
  584.                     file, which can then be assembled and the resulting
  585.                     .OBJ file linked into a program.
  586.  
  587. Test Driving PGRAPH
  588.  
  589. If you are running in a network environment, or wish to spool the printer
  590. output to a file, you should first set up the printer output system. For
  591. example, on a Novell Netware system, you should LOGIN and use CAPTURE to
  592. direct the output of LPT1 to your network printer.
  593.  
  594. To run the demonstration program:
  595.  
  596. *    Change to the directory DEMO.EXE is resident in
  597. *    Copy the BGI driver for your screen into the directory
  598. *    Copy TRIP.CHR (the triplex font file) into the directory
  599. *    Copy any PGI drivers (except STAR and LASERJET) required into the
  600.      directory
  601. *    Execute DEMO.EXE.
  602.  
  603. DEMO.EXE can take the following command line options:
  604.  
  605.      /O=device
  606.      /P=printer_type
  607.      /M=mode
  608.      /D=demos
  609.  
  610. device allows you to redirect the PGRAPH output to another file; for
  611. example /O=STAR.PRN will output to the disk file STAR.PRN, which can later
  612. be printed using COPY/B STAR.PRN LPT1:
  613.  
  614. The default value is PRN
  615.  
  616. printer_type allows you to identify what printer is attached: valid values
  617. are STAR, LASERJET, LX400, USER1, and USER2. Default value is STAR
  618.  
  619. mode allows you to specify which printer mode to use: valid values will
  620. vary, depending on what printer is selected. See the section on p_initgraph
  621. below. The default value depends on the printer and what modes are
  622. available on it -- by default, the program will select the mode which gives
  623.  
  624.  
  625. Copyright - Frank van der Hulst/1991
  626. PGRAPH Printer Graphics Library                                     Page 8.
  627.  
  628.  
  629. sufficient X resolution to print the widest demonstration image (801 pixels
  630. wide), which on most printers will be better than 100dpi. If there are
  631. several modes with that X resolution, it will select the lowest Y
  632. resolution.
  633.  
  634. demos allows you to select which parts of the demo program to run:
  635.  
  636.      A    Draw a full page of lines, ellipses, and polygons
  637.      B    Register stroked fonts (Gothic and script), and print them in
  638.           different sizes and orientations
  639.      C    Print default font in various sizes and orientations
  640.      D    Print stroked (Triplex) and default font horizontally, using
  641.           various justification settings
  642.      E    Print stroked (Triplex) and default font vertically, using
  643.           various justification settings
  644.      F    Print stroked font (Triplex) , using various scaling factors
  645.      G    Fill various shapes with various patterns
  646.      H    Fill an arbitrary shape, using floodfill()
  647.      I    Draw various lines in different directions, with a user-defined
  648.           pattern
  649.      J    Draw circular and elliptical pie charts on the printer.
  650.      K    Display a woman's face on the printer and screen, firstly
  651.           unscaled (it was saved as an image from a CGA screen via
  652.           getimage), then scaled to fit the printer's aspect ratio as near
  653.           as possible. In between, use putimage & getimage, and p_putimage
  654.           & p_getimage, to swap characters from the printer buffer to
  655.           screen and vice versa.
  656.      L    Draw a circular pie chart on the printer, then display it on the
  657.           screen, without printing it.
  658.  
  659. By default, each demo is run in turn. This may take a long time -- for
  660. example, several hours if you have selected 240*216 mode on a dot-matrix
  661. printer.
  662.  
  663.  
  664. Using PGRAPH in your own programs
  665.  
  666. If you are test-driving PGRAPH using the shareware version, rename the
  667. appropriate copy of the library (PGRAPHTT.LIB for Turbo C, PGRAPHLM.LIB for
  668. Microsoft C) to PGRAPH.LIB. If you are using the registered version, rename
  669. either PGR_TC.LIB (for Turbo C) or PGR_MS.LIB (Microsoft C) to PGRAPH.LIB.
  670.  
  671. The demonstration program (DEMO.C and DEMO_SUB.C) may be edited and
  672. compiled. Note that the shareware version of the Turbo C library is for the
  673. Tiny model. Therefore Turbo C programmers compiling the demonstration
  674. program should compile using Tiny model, which will result in certain
  675. functions not being included.
  676.  
  677. Use #include <PGRAPH.H> or #include "PGRAPH.H" in your source file to
  678. include the function prototypes and structure definitions from the header
  679. file at compile time. Turbo C users should include PGRAPH.H after
  680. GRAPHICS.H (if you include that file), since PGRAPH.H includes definitions
  681. for various struct's which are identical to those used in the GRAPHICS.H
  682. header file.
  683.  
  684. Then use the functions provided in PGRAPH.LIB (p_initgraph(), p_putpixel(),
  685. p_closegraph(), etc.) as you would the corresponding initgraph(),
  686. putpixel(), etc.
  687.  
  688.  
  689. Copyright - Frank van der Hulst/1991
  690. PGRAPH Printer Graphics Library                                     Page 9.
  691.  
  692.  
  693. When linking, you must include PGRAPH.LIB so that code can be linked into
  694. the executable. A sample TCC line would be
  695.  
  696.      tcc -mc <other-flags> sample pgraph.lib library.lib
  697.  
  698.  
  699. Limitations and variations from GRAPHICS.LIB
  700.  
  701. 1)    PGRAPH only prints in black and white.
  702.  
  703. 2)   PGRAPH builds up a bit map of the image to be printed in memory, then
  704.      prints it out when p_print() is called. This means that large images
  705.      cannot be printed. An image is not limited to 64K, only to the amount
  706.      of free memory in your machine. It is possible to print a full page of
  707.      high-resolution graphics by printing out several strips (say) 2 inches
  708.      high. For example, a page image on a LaserJet at 300 dpi by 300 dpi
  709.      requires 970K of memory. This could be printed out as 5 strips, each 2
  710.      inches high and requiring 175K.
  711.  
  712. 3)   Because PGRAPH prints from a bit image, it is not suitable for
  713.      outputting to plotters. This also means it can't take advantage of the
  714.      anti-aliasing available on (for example) the LaserJet III.
  715.  
  716. 4)   Because my routines are slightly different from Borland's, some images
  717.      will be printed slightly differently from what you see on the screen.
  718.      This is true for ellipses (and all shapes based on them -- arcs,
  719.      circles, sectors, etc.) where I have used Kappel's ellipse-drawing
  720.      algorithm whereas Borland appear to have used Bresenham's. Usually the
  721.      differences are no more than one or two pixels, except where the
  722.      radius is less than three. Similarly, my line-drawing routine
  723.      sometimes selects different pixels from Borland's. These differences
  724.      will almost always be invisible, except where two shapes are drawn
  725.      close together.
  726.  
  727. 5)   As in GRAPHICS.LIB, arc start and end angles are expressed in degrees,
  728.      with 0 degrees at 3 o'clock, 90 degrees at 12 o'clock, etc. There is a
  729.      minor discrepancy in terms of calculating the start and end points of
  730.      arcs. This may result in a small gap being left between two arcs which
  731.      should end up at the same point.
  732.  
  733.      For example,
  734.  
  735.           p_arc(10, 10, 60, 90, 50);
  736.           p_arc(10, 10,  0, 60, 50);
  737.  
  738.      may not result in a complete arc from 0 to 90 degrees.
  739.  
  740. 6)   GRAPHICS.LIB only allows line, linerel, lineto, rectangle, and
  741.      drawpoly to write in XOR mode after calling setwritemode(XOR_PUT).
  742.      PGRAPH applies the mode set by p_setwritemode() to all output.
  743.  
  744. 7)   When drawing thick lines in XOR mode, the lines may be partially
  745.      erased, particularly diagonal lines and parts of arcs. This is because
  746.      these functions simply plot a 3 by 3 grid of pixels around each point
  747.      on the line, which often means that for a diagonal line the same point
  748.      may be plotted an even number of times, effectively restoring it to
  749.      its original colour.
  750.  
  751.  
  752. Copyright - Frank van der Hulst/1991
  753. PGRAPH Printer Graphics Library                                    Page 10.
  754.  
  755.  
  756.  
  757. 8)   GRAPHICS.LIB allocates 4K (or some other amount set by calling
  758.      setgraphbufsize) for use by routines within it. PGRAPH allocates and
  759.      frees memory as it goes.
  760.  
  761. 9)   White is represented by the value 0 in PGRAPH, and black by 1. In
  762.      GRAPHICS.LIB, it's the other way round.
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812. Copyright - Frank van der Hulst/1991
  813. PGRAPH Printer Graphics Library                                    Page 11.
  814.  
  815.  
  816. PGRAPH Function Reference
  817.  
  818. PGRAPH.LIB contains over 70 functions. Most are similar to those in
  819. GRAPHICS.LIB. A few are extensions. The remainder are used within the
  820. library.
  821.  
  822. These commands are similar to those in GRAPHICS.LIB:
  823.  
  824. p_arc                  p_bar3d                p_bar
  825. p_circle               p_cleardevice          p_clearviewport
  826. p_closegraph           p_drawpoly             p_ellipse
  827. p_fillellipse          p_fillpoly             p_floodfill
  828. p_getarccoords         p_getaspectratio       p_getcolor
  829. p_getdrivername        p_getfillpattern       p_getfillsettings
  830. p_getgraphmode         p_getimage             p_getlinesettings
  831. p_getmaxcolor          p_getmaxmode           p_getmaxx
  832. p_getmaxy              p_getmodename          p_getmoderange
  833. p_getpixel             p_gettextsettings      p_getx
  834. p_gety                 p_graphdefaults        _p_graphfreemem
  835. _p_graphgetmem         p_graphresult          p_imagesize
  836. p_initgraph            p_line                 p_linerel
  837. p_lineto               p_moverel              p_moveto
  838. p_outtext              p_outtextxy            p_pieslice
  839. p_putimage             p_putpixel             p_rectangle
  840. p_registerbgidriver    p_registerbgifont      p_registerfarbgidriver
  841. p_registerfarbgifont   p_sector               p_setaspectratio
  842. p_setcolor             p_setfillpattern       p_setfillstyle
  843. p_setgraphmode         p_setlinestyle         p_settextjustify
  844. p_settextstyle         p_setusercharsize      p_setviewport
  845. p_setwritemode         p_textheight           p_textwidth
  846.  
  847. These commands are new:
  848.  
  849. p_dump                 p_getresolution        p_print
  850. _p_putpixel_screen     p_view
  851.  
  852.  
  853. This section describes how to call each of the PGRAPH functions.
  854.  
  855. Programmers familiar with Turbo C's or Turbo-Pascal's BGI interface, may
  856. wish to skip the following, with the exception of p_getresolution(),
  857. _p_putpixel_screen(), p_print(), p_view(), and p_dump().
  858.  
  859. In addition to the functions which are described in detail below, there are
  860. several functions in PGRAPH which are "visible" to the linker, but not
  861. described in detail below. These routines are called from within the PGRAPH
  862. library, and should not be called by external programs.
  863.  
  864. Functions are described below in alphabetical order:
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872. Copyright - Frank van der Hulst/1991
  873. PGRAPH Printer Graphics Library                                    Page 12.
  874.  
  875.  
  876. ---------------------------------------------------------------------------
  877. p_arc
  878. void p_arc(int x, int y, int stangle, int endangle, int radius);
  879.  
  880. Draws a circular arc in the current drawing colour, centred at (x,y) with
  881. the given radius. The arc travels from stangle to endangle, in a
  882. counterclockwise direction. The thickness of the line can be set using the
  883. thickness parameter of p_setlinestyle().
  884.  
  885. This routine allocates memory via _p_graphgetmem, and frees it again
  886. afterwards via _p_graphfreemem. If the memory is not available, a call to
  887. p_graphresult will return a value of -6.
  888.  
  889. See also: p_circle, p_ellipse, p_getarccoords, p_getaspectratio,
  890. p_graphresult, p_pieslice, p_setwritemode
  891.  
  892. ---------------------------------------------------------------------------
  893. p_bar
  894. void p_bar(int left, int top, int right, int bottom);
  895.  
  896. Draws a filled-in rectangle, using the current fill pattern and colour. The
  897. bar is not outlined.
  898.  
  899. This routine allocates memory via _p_graphgetmem, and frees it again
  900. afterwards via _p_graphfreemem. If the memory is not available, a call to
  901. p_graphresult will return a value of -6.
  902.  
  903. See also: p_bar3d, p_fillpoly, p_floodfill, p_graphresult, p_setfillstyle
  904.  
  905. ---------------------------------------------------------------------------
  906. p_bar3d
  907. void p_bar3d(int left, int top, int right, int bottom, int depth, int
  908. topflag);
  909.  
  910. Draws a three-dimensional rectangular bar, using the current line style and
  911. colour. The front face is filled in using the current fill style and
  912. colour. The depth parameter gives the bar's depth, in pixels. A depth of 0
  913. gives an outlined two-dimensional bar. If topflag is non-zero, a three-
  914. dimensional top is put on the bar, otherwise only the front face and right
  915. side are drawn. (left, top) and (right, bottom) give the pixel coordinates
  916. of the upper left and lower right corners of the rectangle.
  917.  
  918. See also: p_bar, p_setcolor, p_setfillstyle, p_setlinestyle
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932. Copyright - Frank van der Hulst/1991
  933. PGRAPH Printer Graphics Library                                    Page 13.
  934.  
  935.  
  936. ---------------------------------------------------------------------------
  937. p_circle
  938. void p_circle(int x, int y, int radius);
  939.  
  940. Draws a circle in the current drawing colour, centred at (x,y) with the
  941. given radius. The thickness of the line can be set using the thickness
  942. parameter of p_setlinestyle().
  943.  
  944. The circle will always have the correct diameter in the X direction, but
  945. the number of pixels in the Y direction will be altered (using the current
  946. aspect ratio) to ensure that the circle is round.
  947.  
  948. This routine allocates memory via _p_graphgetmem, and frees it again
  949. afterwards via _p_graphfreemem. If the memory is not available, a call to
  950. p_graphresult will return a value of -6.
  951.  
  952. See also: p_arc, p_ellipse, p_fillellipse, p_getarccoords, p_graphresult,
  953. p_setaspectratio, p_setwritemode
  954.  
  955. ---------------------------------------------------------------------------
  956. p_cleardevice
  957. void p_cleardevice(void);
  958.  
  959. Clears the print buffer to zeros, and moves the graphics cursor to (0, 0).
  960. This clears the viewport by directly writing zeros into the print buffer
  961. memory. As such, it quickly clears the buffer. However, it does not clear
  962. pixels drawn on the screen via _p_putpixel_screen.
  963.  
  964. See also: p_clearviewport, _p_putpixel_screen
  965.  
  966. ---------------------------------------------------------------------------
  967. p_clearviewport
  968. void p_clearviewport(void);
  969.  
  970. Clears the print buffer to zeros, and moves the graphics cursor to (0, 0).
  971. This is done pixel by pixel, by calling p_putpixel.
  972.  
  973. See also: p_cleardevice, p_getviewsettings, p_putpixel, p_setviewport
  974.  
  975. ---------------------------------------------------------------------------
  976. p_closegraph
  977. void p_closegraph(void);
  978.  
  979. Shuts down the PGRAPH system; deallocates the memory reserved for the print
  980. buffer, drivers, and fonts by calling _p_graphfreemem.
  981.  
  982. Note that this does NOT print any graphics remaining in the buffer; you
  983. should call p_print first if necessary.
  984.  
  985. See also: p_initgraph, _p_graphfreemem, p_print
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992. Copyright - Frank van der Hulst/1991
  993. PGRAPH Printer Graphics Library                                    Page 14.
  994.  
  995.  
  996. ---------------------------------------------------------------------------
  997. p_drawpoly
  998. void p_drawpoly(int numpoints, int far *polypoints);
  999.  
  1000. Draws the outline of a polygon with numpoints points, using the current
  1001. line style and colour.
  1002.  
  1003. polypoints points to a sequence of x,y pairs of coordinates. In order to
  1004. draw a closed polygon, the last coordinate must be the same as the first.
  1005.  
  1006. See also: p_fillpoly, p_line, p_rectangle, p_setcolor, p_setfillstyle,
  1007. p_setlinestyle
  1008.  
  1009. ---------------------------------------------------------------------------
  1010. p_dump
  1011. void p_dump(void);
  1012.  
  1013. Dumps the contents of the print buffer to stdout in hex. For use in
  1014. debugging.
  1015.  
  1016. See also: p_view, p_print
  1017.  
  1018. ---------------------------------------------------------------------------
  1019. p_ellipse
  1020. void p_ellipse(int x, int y, int stangle, int endangle, int xradius, int
  1021. yradius);
  1022.  
  1023. Draws an elliptical arc in the current drawing colour, centred at (x,y)
  1024. with the given x and y radii. The arc travels from stangle to endangle, in
  1025. a counterclockwise direction. The thickness of the line can be set using
  1026. the thickness parameter of p_setlinestyle().
  1027.  
  1028. This routine allocates memory via _p_graphgetmem, and frees it again
  1029. afterwards via _p_graphfreemem. If the memory is not available, a call to
  1030. p_graphresult will return a value of -6.
  1031.  
  1032. See also: p_arc, p_circle, p_fillellipse, p_getaspectratio, p_graphresult,
  1033. p_sector, p_setwritemode
  1034.  
  1035. ---------------------------------------------------------------------------
  1036. p_fillellipse
  1037. void p_fillellipse( int x, int y, int xradius, int yradius );
  1038.  
  1039. Draws an ellipse in the current drawing colour, centred at (x,y) with the
  1040. given x and y radii. The thickness of the line can be set using the
  1041. thickness parameter of p_setlinestyle().
  1042.  
  1043. The interior of the ellipse is filled with the current fill colour and
  1044. pattern.
  1045.  
  1046. This routine allocates memory via _p_graphgetmem, and frees it again
  1047. afterwards via _p_graphfreemem. If the memory is not available, a call to
  1048. p_graphresult will return a value of -6.
  1049.  
  1050. See also: p_ellipse, p_fillpoly, p_getaspectratio, p_graphresult,
  1051. p_setcolor, p_setfillstyle, p_setlinestyle
  1052.  
  1053.  
  1054.  
  1055. Copyright - Frank van der Hulst/1991
  1056. PGRAPH Printer Graphics Library                                    Page 15.
  1057.  
  1058.  
  1059. ---------------------------------------------------------------------------
  1060. p_fillpoly
  1061. void p_fillpoly(int numpoints, int far *polypoints);
  1062.  
  1063. Draws the outline of a polygon with numpoints points, using the current
  1064. line style and colour. The interior of the polygon is filled with the
  1065. current fill colour and pattern.
  1066.  
  1067. polypoints points to a sequence of x,y pairs of coordinates. In order to
  1068. draw a closed polygon, the last coordinate must be the same as the first.
  1069.  
  1070. This routine allocates memory via _p_graphgetmem, and frees it again
  1071. afterwards via _p_graphfreemem. If the memory is not available, a call to
  1072. p_graphresult will return a value of -7.
  1073.  
  1074. See also: p_drawpoly, p_floodfill, p_graphresult, p_setcolor,
  1075. p_setfillstyle, p_setlinestyle
  1076.  
  1077. ---------------------------------------------------------------------------
  1078. p_floodfill
  1079. void p_floodfill(int x, int y, int border);
  1080.  
  1081. Fills an enclosed area of the bitmap. (x, y) is a "seed point" inside the
  1082. area to be filled. The area bounded by the specified border colour will be
  1083. filled with the current fill pattern and colour.
  1084.  
  1085. Where possible, p_fillpoly should be used, since it runs much faster.
  1086.  
  1087. This routine allocates memory via _p_graphgetmem, and frees it again
  1088. afterwards via _p_graphfreemem. If the memory is not available, a call to
  1089. p_graphresult will return a value of -7.
  1090.  
  1091. See also: p_drawpoly, p_fillpoly, p_graphresult, p_setcolor, p_setfillstyle
  1092.  
  1093. ---------------------------------------------------------------------------
  1094. p_getarccoords
  1095. void p_getarccoords(struct arccoordstype far *arccoords);
  1096.  
  1097. Fills the structure pointed to by arccoords with information about the last
  1098. arc (elliptical or circular) drawn. This includes information about the
  1099. centre of the arc, and the coordinates of each end of the arc. These are
  1100. useful if you need to connect a line to the end of an arc.
  1101.  
  1102. See also: p_arc, p_ellipse, p_getaspectratio
  1103.  
  1104. ---------------------------------------------------------------------------
  1105. p_getaspectratio
  1106. void p_getaspectratio(int far *xasp, int far *yasp);
  1107.  
  1108. Returns the aspect ratio of the current printer graphics mode. The value of
  1109. *yasp will usually be 10,000 or close to it; the value of *xasp depends on
  1110. the relative width and height of pixels in the current mode. If pixels are
  1111. taller than they are wide, *xasp will be less than *yasp. If pixels are
  1112. shorter than they are wide, *xasp will be greater than *yasp. If pixels are
  1113. square, *xasp and *yasp will be equal.
  1114.  
  1115. See also: p_arc, p_circle, p_pieslice, p_setaspectratio
  1116.  
  1117.  
  1118.  
  1119. Copyright - Frank van der Hulst/1991
  1120. PGRAPH Printer Graphics Library                                    Page 16.
  1121.  
  1122.  
  1123. ---------------------------------------------------------------------------
  1124. p_getcolor
  1125. int p_getcolor(void);
  1126.  
  1127. Returns the current drawing colour.
  1128.  
  1129. See also: p_getmaxcolor, p_setcolor
  1130.  
  1131. ---------------------------------------------------------------------------
  1132. p_getdrivername
  1133. char *p_getdrivername(void);
  1134.  
  1135. Returns a pointer to a string containing the name of the current printer.
  1136. If PGRAPH has not been initialised, returns NULL.
  1137.  
  1138. See also: p_initgraph, p_getmodename
  1139.  
  1140. ---------------------------------------------------------------------------
  1141. p_getfillpattern
  1142. void p_getfillpattern(char far *pattern);
  1143.  
  1144. Copies the user-defined fill pattern (as set by p_setfillpattern) into the
  1145. 8-byte area pointed to by pattern.
  1146.  
  1147. See also: p_setfillpattern, p_getfillsettings
  1148.  
  1149. ---------------------------------------------------------------------------
  1150. p_getfillsettings
  1151. void p_getfillsettings(struct fillsettingstype far *fillinfo);
  1152.  
  1153. Fills in the structure pointed to by fillinfo, giving information about the
  1154. current fill pattern and colour.
  1155.  
  1156. See also: p_setfillstyle
  1157.  
  1158. ---------------------------------------------------------------------------
  1159. p_getgraphmode
  1160. int p_getgraphmode(void);
  1161.  
  1162. Returns the current graphics mode (set by p_initgraph or p_setgraphmode).
  1163. The enumeration p_graphics_modes, defined in PGRAPH.H, gives names for the
  1164. predefined graphics modes.
  1165.  
  1166. See also: p_getmoderange, p_initgraph, p_setgraphmode
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179. Copyright - Frank van der Hulst/1991
  1180. PGRAPH Printer Graphics Library                                    Page 17.
  1181.  
  1182.  
  1183. ---------------------------------------------------------------------------
  1184. p_getimage
  1185. void p_getimage(int left, int top, int right, int bottom, void far
  1186. *bitmap);
  1187.  
  1188. Copies a bit image of the specified rectangle from the print buffer to
  1189. memory. (left, top) and (right, bottom) give the pixel coordinates of the
  1190. upper left and lower right corners of the rectangle. bitmap points to an
  1191. area of memory large enough to store the image. The first two words are
  1192. used to store the width and height of the image.
  1193.  
  1194. The image is stored in the same format as that used by getimage and
  1195. putimage in GRAPHICS.LIB for black and white screen images, except that
  1196. black is represented by a '1' bit, and white by a '0'.
  1197.  
  1198. See also: p_imagesize, p_putimage
  1199.  
  1200. ---------------------------------------------------------------------------
  1201. p_getlinesettings
  1202. void p_getlinesettings(struct linesettingstype far *linetypeinfo);
  1203.  
  1204. Fills in the structure pointed to by linetypeinfo, giving information about
  1205. the current line style and thickness.
  1206.  
  1207. See also: p_setlinestyle
  1208.  
  1209. ---------------------------------------------------------------------------
  1210. p_getmaxcolor
  1211. int p_getmaxcolor(void);
  1212.  
  1213. Returns the highest valid colour value (always 1).
  1214.  
  1215. See also: p_getcolor, p_setcolor
  1216.  
  1217. ---------------------------------------------------------------------------
  1218. p_getmaxmode
  1219. int p_getmaxmode(void);
  1220.  
  1221. Returns the highest valid mode number for the current driver. The minimum
  1222. mode is always 0.
  1223.  
  1224. See also: p_getmodename, p_getmoderange, p_setgraphmode
  1225.  
  1226. ---------------------------------------------------------------------------
  1227. p_getmaxx
  1228. int p_getmaxx(void);
  1229.  
  1230. Returns the maximum x coordinate for the current viewport. For example, if
  1231. a viewport is 2400x600, this returns 2399.
  1232.  
  1233. See also: p_getmaxy, p_getx, p_setviewport
  1234.  
  1235. ---------------------------------------------------------------------------
  1236. p_getmaxy
  1237. int p_getmaxy(void);
  1238.  
  1239. Returns the maximum y coordinate for the current viewport. For example, if
  1240. a viewport is 2400x600, this returns 599.
  1241.  
  1242. See also: p_getmaxx, p_gety, p_setviewport
  1243.  
  1244.  
  1245.  
  1246. Copyright - Frank van der Hulst/1991
  1247. PGRAPH Printer Graphics Library                                    Page 18.
  1248.  
  1249.  
  1250. ---------------------------------------------------------------------------
  1251. p_getmodename
  1252. char *p_getmodename(int mode_number);
  1253.  
  1254. Returns a pointer to a string containing the name of the current graphics
  1255. mode. If PGRAPH has not been initialised, returns NULL.
  1256.  
  1257. See also: p_initgraph, p_getdrivername
  1258.  
  1259. ---------------------------------------------------------------------------
  1260. p_getmoderange
  1261. void p_getmoderange(int graphdriver, int far *lomode, int far *himode);
  1262.  
  1263. Returns the range of valid mode numbers for the specified driver. The
  1264. minimum mode is always 0. If graphdriver is invalid, both *lomode and
  1265. *himode are set to -1. If graphdriver is -1, the current driver's mode
  1266. range is returned.
  1267.  
  1268. See also: p_getgraphmode, p_getmaxmode, p_getmodename, p_graph_result,
  1269. p_initgraph, p_setgraphmode
  1270.  
  1271. ---------------------------------------------------------------------------
  1272. p_getpixel
  1273. unsigned p_getpixel(int x, int y);
  1274.  
  1275. Returns the colour of the pixel located at (x, y).
  1276.  
  1277. All routines which read the print buffer, except for p_print and p_dump,
  1278. call p_getpixel.
  1279.  
  1280. See also: p_getimage, p_putpixel
  1281.  
  1282. ---------------------------------------------------------------------------
  1283. p_getresolution
  1284. void p_getresolution(int far *xres, int far *yres);
  1285.  
  1286. Returns the resolution in dots per inch of the current printer graphics
  1287. mode.
  1288.  
  1289. See also: p_getaspectratio, p_initgraph
  1290.  
  1291. ---------------------------------------------------------------------------
  1292. p_gettextsettings
  1293. void p_gettextsettings(struct textsettingstype far *texttypeinfo);
  1294.  
  1295. Fills in the structure pointed to by texttypeinfo, giving information about
  1296. the current font, direction, size, and justification of text.
  1297.  
  1298. See also: p_outtext, p_outtextxy, p_settextjustify, p_settextstyle,
  1299. p_setusercharsize
  1300.  
  1301. ---------------------------------------------------------------------------
  1302. p_getx
  1303. int p_getx(void);
  1304.  
  1305. Returns the graphics cursor x coordinate within the current viewport.
  1306.  
  1307. See also: p_getmaxx, p_gety, p_moveto, p_setviewport
  1308.  
  1309.  
  1310.  
  1311. Copyright - Frank van der Hulst/1991
  1312. PGRAPH Printer Graphics Library                                    Page 19.
  1313.  
  1314.  
  1315. ---------------------------------------------------------------------------
  1316. p_gety
  1317. int p_gety(void);
  1318.  
  1319. Returns the graphics cursor y coordinate within the current viewport.
  1320.  
  1321. See also: p_getmaxy, p_getx, p_moveto, p_setviewport
  1322.  
  1323. ---------------------------------------------------------------------------
  1324. p_graphdefaults
  1325. void p_graphdefaults(void);
  1326.  
  1327. Resets all graphics settings to their defaults:
  1328.                        Sets the viewport to 8 inches by 2 inches
  1329.                        Moves the graphics cursor to (0, 0)
  1330.                        Sets the drawing colour to 1 (black)
  1331.                        Sets the current fill style and pattern
  1332.                        Sets the text font and justification
  1333.  
  1334. Note that changing the viewport will free the memory allocated for the
  1335. print buffer via _p_graphfreemem, and allocate memory for the new buffer
  1336. via _p_graphgetmem. If the memory is not available, a call to p_graphresult
  1337. will return a value of -5.
  1338.  
  1339. See also: p_graphresult, p_initgraph, p_setgraphmode, p_setviewport
  1340.  
  1341. ---------------------------------------------------------------------------
  1342. _p_graphfreemem
  1343. void _p_graphfreemem(void far *ptr, unsigned long size);
  1344.  
  1345. This function is called by various PGRAPH functions whenever they need to
  1346. release memory previously allocated through _p_graphgetmem. You can define
  1347. your own version of _p_graphfreemem to control memory management. This
  1348. might be useful if you have routines to allocate memory to programs from
  1349. within Extended or Expanded memory.
  1350.  
  1351. Turbo C: The version defined in PGRAPH simply calls farfree.
  1352. Microsoft C: The version defined in PGRAPH simply calls hfree. Programmers
  1353. using other compilers should define _p_graphfreemem to call the equivalent
  1354. memory allocation routine provided by their compiler vendor.
  1355.  
  1356. Note that this differs from _graphfreemem in GRAPHICS.LIB, in that it
  1357. allows use of blocks larger than 64K.
  1358.  
  1359. See also: _p_graphgetmem
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371. Copyright - Frank van der Hulst/1991
  1372. PGRAPH Printer Graphics Library                                    Page 20.
  1373.  
  1374.  
  1375. ---------------------------------------------------------------------------
  1376. _p_graphgetmem
  1377. void far * _p_graphgetmem(unsigned long size);
  1378.  
  1379. This function is called by various PGRAPH functions whenever they need to
  1380. dynamically allocate memory for various buffers. You can define your own
  1381. version of _p_graphgetmem to control memory management. This might be
  1382. useful if you have routines to allocate memory to programs from within
  1383. Extended or Expanded memory.
  1384.  
  1385. Turbo C: The version defined in PGRAPH simply calls farmalloc.
  1386. Microsoft C: The version defined in PGRAPH simply calls halloc.
  1387. Programmers using other compilers should define _p_graphgetmem to call the
  1388. equivalent memory allocation routine provided by their compiler vendor.
  1389.  
  1390. Note that this differs from _graphgetmem in GRAPHICS.LIB, in that it allows
  1391. use of blocks larger than 64K.
  1392.  
  1393. See also: _p_graphfreemem
  1394.  
  1395. ---------------------------------------------------------------------------
  1396. p_graphresult
  1397. int p_graphresult(void);
  1398.  
  1399. This returns an error code for the last unsuccessful graphics operation,
  1400. and resets the error level to grOk. Therefore the result returned should be
  1401. stored by the calling program before testing it.
  1402.  
  1403. These codes are the same as used in GRAPHICS.LIB, therefore you can call
  1404. grapherrormsg from there to print the corresponding error message.
  1405.  
  1406. The following table list error codes returned by p_graphresult.
  1407.  
  1408.      Error          Constant            Error Message
  1409.  
  1410.          0          grOk                No error
  1411.         -1          grNoInitGraph       Graphics not installed (use
  1412.                                         p_initgraph)
  1413.         -2          grNotDetected       Graphics hardware not detected (not
  1414.                                         used)
  1415.         -3          grFileNotFound      Device driver file not found
  1416.         -4          grInvalidDriver     Invalid device driver file
  1417.         -5          grNoLoadMem         Not enough memory to load driver or
  1418.                                         print buffer
  1419.         -6          grNoScanMem         Out of memory when scanning ellipse
  1420.         -7          grNoFloodMem        Out of memory in flood fill
  1421.         -8          grFontNotFound      Font file not found
  1422.         -9          grNoFontMem         Not enough memory to load font
  1423.        -10          grInvalidMode       Invalid graphics mode for selected
  1424.                                         driver
  1425.        -11          grError             Graphics error
  1426.        -12          grIOerror           Graphics I/O error
  1427.        -13          grInvalidFont       Invalid font file
  1428.        -14          grInvalidFontNum    Invalid font number
  1429.        -15          grInvalidDeviceNum  Invalid device number
  1430.        -16          grInvalidVersion    Invalid version number
  1431.  
  1432. See also: graph_errors in PGRAPH.H
  1433.  
  1434.  
  1435.  
  1436. Copyright - Frank van der Hulst/1991
  1437. PGRAPH Printer Graphics Library                                    Page 21.
  1438.  
  1439.  
  1440. ---------------------------------------------------------------------------
  1441. p_imagesize
  1442. unsigned p_imagesize(int left, int top, int right, int bottom);
  1443.  
  1444. Returns the number of bytes required to store a bit image. If the size
  1445. required is greater than 65534 (0xFFFE), p_imagesize returns 65535
  1446. (0xFFFF).
  1447.  
  1448. See also: p_getimage, p_putimage
  1449.  
  1450. ---------------------------------------------------------------------------
  1451. p_initgraph
  1452. void p_initgraph(int far *graphdriver, int far *graphmode, char far
  1453. *pathtodriver);
  1454.  
  1455. This initialises the PGRAPH system by loading a graphics driver from disk
  1456. (or using a registered driver), and putting the system into the selected
  1457. graphics mode. Unlike initgraph in GRAPHICS.LIB, p_initgraph cannot auto-
  1458. detect what type of printer is attached.
  1459.  
  1460. p_initgraph first checks to see whether the selected driver has already
  1461. been loaded, or has been registered via p_registerbgidriver or
  1462. p_registerfarbgidriver. If not, it loads the driver (.PGI) file from disk,
  1463. including allocating memory for it via _p_graphgetmem.
  1464.  
  1465. p_initgraph always sets the internal error code; on success it sets it to
  1466. 0. If an error occurred, *graphdriver is set to the same value as the
  1467. internal error code.
  1468.  
  1469. pathtodriver specifies the directory path where the driver file is located.
  1470. If the file is not found in that directory, or pathtodriver is NULL,
  1471. p_initgraph looks for the file in the current directory. This is also used
  1472. by p_settextstyle to search for font (.CHR) files.
  1473.  
  1474. *graphdriver is an integer between 1 and 5 which specifies the printer
  1475. driver to be used. You give it a value using a constant of the
  1476. p_graphics_drivers enumeration type, defined in PGRAPH.H, and listed below:
  1477.  
  1478.      Value          Constant
  1479.          1          STAR
  1480.          2          LASERJET
  1481.          3          LX400
  1482.          4          USER1
  1483.          5          USER2
  1484.  
  1485. The constants USER1 and USER2 allow for up to 2 user-created drivers to be
  1486. installed and used. When one of these is used, PGRAPH first checks whether
  1487. it has been registered; if not, it loads USER1.PGI or USER2.PGI from disk.
  1488.  
  1489. *graphmode specifies the initial graphics mode. If it is not in the correct
  1490. range for the selected driver, the initialisation is aborted, and
  1491. p_graphresult will return -10. It should be selected from the following
  1492. table:
  1493.  
  1494.  
  1495.  
  1496. Copyright - Frank van der Hulst/1991
  1497. PGRAPH Printer Graphics Library                                    Page 22.
  1498.  
  1499.  
  1500.  
  1501.      Driver    Mode           Value     Resolution (dpi)
  1502.      STAR      STAR_60_72         0     60  x  72
  1503.                STAR_120_216       1     120 x 216
  1504.                STAR_120_108       2     120 x 108
  1505.                STAR_120_72        3     120 x  72
  1506.                STAR_240_216       4     240 x 216
  1507.                STAR_80_72         5      80 x  72
  1508.                STAR_72_72         6      72 x  72
  1509.                STAR_90_72         7      90 x  72
  1510.  
  1511.      LASERJET  LJ_75_75           0      75 x  75
  1512.                LJ_100_100         1     100 x 100
  1513.                LJ_150_150         2     150 x 150
  1514.                LJ_300_300         3     300 x 300
  1515.  
  1516.      LX400     LX400_60_72        0      60 x  72
  1517.                LX400_120_216      1     120 x 216
  1518.                LX400_120_108      2     120 x 108
  1519.                LX400_120_72       3     120 x  72
  1520.                LX400_240_216      4     240 x 216
  1521.                LX400_40_72        5      40 x  72
  1522.                LX400_80_72        6      80 x  72
  1523.                LX400_90_72        7      90 x  72
  1524.  
  1525.      USER1
  1526.      USER2
  1527.  
  1528. See also: p_closegraph, p_getdrivername, p_setgraphmode, p_graphdefaults,
  1529. _p_graphgetmem, p_graphresult, p_registerbgidriver, p_setgraphmode
  1530.  
  1531. ---------------------------------------------------------------------------
  1532. p_line
  1533. void p_line(int x1, int y1, int x2, int y2);
  1534.  
  1535. Draws a line from (x1, y1) to (x2, y2), using the current line style and
  1536. colour. This does not change the position of the graphics cursor.
  1537.  
  1538. See also: p_linerel, p_lineto, p_setcolor, p_setlinestyle, p_setwritemode
  1539.  
  1540. ---------------------------------------------------------------------------
  1541. p_linerel
  1542. void p_linerel(int dx, int dy);
  1543.  
  1544. Draws a line from the graphics cursor (CP) to (CP.x + dx, CP.y + dy), using
  1545. the current line style and colour. The graphics cursor is then moved to the
  1546. new point.
  1547.  
  1548. See also: p_line, p_lineto, p_setcolor, p_setlinestyle, p_setwritemode
  1549.  
  1550. ---------------------------------------------------------------------------
  1551. p_lineto
  1552. void p_lineto(int x, int y);
  1553.  
  1554. Draws a line from the graphics cursor to (x, y), using the current line
  1555. style and colour. The graphics cursor is then moved to (x, y).
  1556.  
  1557. See also: p_line, p_linerel, p_setcolor, p_setlinestyle, p_setwritemode
  1558.  
  1559.  
  1560.  
  1561. Copyright - Frank van der Hulst/1991
  1562. PGRAPH Printer Graphics Library                                    Page 23.
  1563.  
  1564.  
  1565. ---------------------------------------------------------------------------
  1566. p_moverel
  1567. void p_moverel(int dx, int dy);
  1568.  
  1569. Moves the graphics cursor (CP) to (CP.x + dx, CP.y + dy).
  1570.  
  1571. See also: p_linerel, p_moveto
  1572.  
  1573. ---------------------------------------------------------------------------
  1574. p_moveto
  1575. void p_moveto(int x, int y);
  1576.  
  1577. Moves the graphics cursor to (x, y).
  1578.  
  1579. See also: p_lineto, p_moverel, p_outtext
  1580.  
  1581. ---------------------------------------------------------------------------
  1582. p_outtext
  1583. void p_outtext(char far *textstring);
  1584.  
  1585. Displays a string at the graphics cursor in the viewport, using the current
  1586. text settings and colour. If the horizontal justification is LEFT_TEXT and
  1587. the direction is HORIZ_DIR, the graphics cursor's x coordinate is advanced
  1588. by p_textwidth(textstring). Otherwise it remains unchanged. p_textwidth and
  1589. p_textheight should be used to maintain code compatibility across several
  1590. fonts.
  1591.  
  1592. See also: p_outtextxy, p_settextjustify, p_settextstyle, p_textheight,
  1593. p_textwidth
  1594.  
  1595. ---------------------------------------------------------------------------
  1596. p_outtextxy
  1597. void p_outtextxy(int x, int y, char far *textstring);
  1598.  
  1599. Displays a string at (x, y) in the viewport, using the current text
  1600. settings and colour. The graphics cursor remains unchanged. p_textwidth and
  1601. p_textheight should be used to maintain code compatibility across several
  1602. fonts.
  1603.  
  1604. See also: p_outtext, p_settextjustify, p_settextstyle, p_textheight,
  1605. p_textwidth
  1606.  
  1607. ---------------------------------------------------------------------------
  1608. p_pieslice
  1609. void p_pieslice(int x, int y, int stangle, int endangle, int radius);
  1610.  
  1611. Draws a circular arc in the current drawing colour, centred at (x,y) with
  1612. the given radius. The arc travels from stangle to endangle, in a
  1613. counterclockwise direction. Lines are drawn from each end of the arc to (x,
  1614. y). The thickness of the lines and arc can be set using the thickness
  1615. parameter of p_setlinestyle(). The interior of the pie slice is filled
  1616. using the current fill pattern and colour.
  1617.  
  1618. This routine allocates memory via _p_graphgetmem, and frees it again
  1619. afterwards via _p_graphfreemem. If the memory is not available, a call to
  1620. p_graphresult will return a value of -6.
  1621.  
  1622. See also: p_arc, p_fillellipse, p_getarccoords, p_getaspectratio,
  1623. p_graphresult, p_sector, p_setfillstyle
  1624.  
  1625.  
  1626.  
  1627. Copyright - Frank van der Hulst/1991
  1628. PGRAPH Printer Graphics Library                                    Page 24.
  1629.  
  1630.  
  1631. ---------------------------------------------------------------------------
  1632. p_print
  1633. void p_print(int out_dev);
  1634.  
  1635. This routine actually prints the contents of the print buffer. To do this,
  1636. it switches the printer into graphics mode, then sends each line of pixels
  1637. to the printer. If the driver is set for a dot matrix printer, up to eight
  1638. lines of pixels may be printed at once. Finally, the printer is returned to
  1639. normal text mode.
  1640.  
  1641. Only the x part of the viewport location selected using p_setviewport is
  1642. used. Each print will begin printing at the current print position of the
  1643. printer. This means that it is possible to print an entire page by drawing
  1644. horizontal slices of it, and printing each one separately.
  1645.  
  1646. The parameter out_dev is the file handle for the output device. To output
  1647. directly to a printer, use p_print(fileno(stdprn)); Alternatively, the
  1648. output can be sent to any file. The file should be opened in binary mode.
  1649.  
  1650. See also: p_dump, p_setviewport, p_view
  1651.  
  1652. ---------------------------------------------------------------------------
  1653. p_putimage
  1654. void p_putimage(int left, int top, void far *bitmap, int op);
  1655.  
  1656. Copies a bit image of the specified rectangle from memory to the print
  1657. buffer. (left, top) gives the viewport coordinates of the upper left corner
  1658. of the rectangle. bitmap points to the area of memory used to store the
  1659. image. The first two words contain the width and height of the image.
  1660.  
  1661. The image is stored in the same format as that used by getimage and
  1662. putimage in GRAPHICS.LIB for black and white screen images, except that
  1663. black is represented by a '1' bit, and white by a '0'.
  1664.  
  1665. The op parameter specifies how each pixel from the memory area is to be
  1666. combined with pixels in the print buffer. You give it a value using a
  1667. constant of the putimage_types enumeration type, defined in PGRAPH.H, and
  1668. listed below:
  1669.  
  1670.      Value          Constant            Description
  1671.          0          COPY_PUT            Copy
  1672.          1          XOR_PUT             exclusive or
  1673.          2          OR_PUT              inclusive or
  1674.          3          AND_PUT             and
  1675.          4          NOT_PUT             copy inverse of source
  1676.  
  1677. Often NOT_PUT is the most appropriate, since in PGRAPH 0 represents white
  1678. and 1 represents black, whereas in GRAPHICS (on the screen) 0 represents
  1679. black and 1 represents white.
  1680.  
  1681. See also: p_getimage, p_imagesize
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687. Copyright - Frank van der Hulst/1991
  1688. PGRAPH Printer Graphics Library                                    Page 25.
  1689.  
  1690.  
  1691. ---------------------------------------------------------------------------
  1692. p_putpixel
  1693. void p_putpixel(int x, int y, int colour);
  1694.  
  1695. Plots the pixel located at (x, y) in the colour specified. Depending on the
  1696. writing mode set via p_setwritemode, this may copy the pixel to the buffer,
  1697. or else exclusive-or the pixel with the buffer.
  1698.  
  1699. This also calls _p_putpixel_screen with the same parameters as were passed
  1700. to it.
  1701.  
  1702. All output to the print buffer, except p_cleardevice, goes via p_putpixel.
  1703.  
  1704. See also: p_clear_device, p_getpixel, p_putimage, p_setwritemode
  1705.  
  1706. ---------------------------------------------------------------------------
  1707. _p_putpixel_screen
  1708. void _p_putpixel_screen(int x, int y, int colour);
  1709.  
  1710. This function is called by p_putpixel every time it is called.
  1711. Turbo C users can define their own version of _p_putpixel_screen as follows
  1712. to  simultaneously output printed images to a viewport on the screen. This
  1713. might be useful when debugging a program.
  1714.  
  1715. void _p_putpixel_screen(int x, int y, int colour)
  1716. {
  1717.      putpixel(x, y, colour);
  1718. }
  1719.  
  1720. The version defined in the library does nothing; it simply returns.
  1721.  
  1722. People using a compiler/linker other than Turbo C could also use this as a
  1723. mechanism to get Turbo C programs to run with their own compiler, provided
  1724. that they have a routine which can plot a pixel on the screen. Note that
  1725. the routines in PGRAPH are generally much slower than the equivalent
  1726. routines in GRAPHICS.LIB, and therefore reduce the performance of programs
  1727. run this way.
  1728.  
  1729. See also: p_putpixel
  1730.  
  1731. ---------------------------------------------------------------------------
  1732. p_rectangle
  1733. void p_rectangle(int left, int top, int right, int bottom);
  1734.  
  1735. Draws a rectangle in the current line style, thickness, and colour. (left,
  1736. top) and (right, bottom) identify the upper left and lower right corners of
  1737. the rectangle.
  1738.  
  1739. See also: p_par, p_line, p_setcolor, p_setlinestyle
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747. Copyright - Frank van der Hulst/1991
  1748. PGRAPH Printer Graphics Library                                    Page 26.
  1749.  
  1750.  
  1751. ---------------------------------------------------------------------------
  1752. p_registerbgidriver
  1753. int p_registerbgidriver(void (*driver)(void));
  1754.  
  1755. Identifies a user-loaded or linked-in graphics driver to PGRAPH. This
  1756. routine checks that the data at the given address is a valid driver; if not
  1757. it returns a negative number indicating the error. Otherwise it returns a
  1758. number which you MUST use when you call p_initgraph if you wish to use this
  1759. driver. Once its address has been passed to p_registerbgidriver,
  1760. p_initgraph will use the registered driver (rather than loading it from
  1761. disk) if that driver is called for.
  1762.  
  1763. Note that .PGI files will need to be converted into .OBJ format. The BINOBJ
  1764. program distributed by Borland as part of Turbo-Pascal is suitable for
  1765. this, although it only generates upper-case names, and the user needs to
  1766. add a leading underscore to the public name.
  1767.  
  1768. See also: p_graphresult, p_initgraph, p_registerbgifont,
  1769. p_registerfarbgidriver
  1770.  
  1771. ---------------------------------------------------------------------------
  1772.                                                                            p_registerbgifont
  1773. int p_registerbgifont(void (*font)(void));
  1774.  
  1775. Identifies a user-loaded or linked-in font to PGRAPH. This routine checks
  1776. that the data at the given address is a valid font; if not it returns a
  1777. negative number indicating the error. Otherwise it returns a number which
  1778. you MUST use when you call p_settextstyle if you wish to use this driver.
  1779. Once its address has been passed to p_registerbgifont, p_settextstyle will
  1780. use the registered font (rather than loading it from disk) if that font is
  1781. called for.
  1782.  
  1783. Note that fonts registered for GRAPHICS.LIB via registerbgifont may also be
  1784. registered for PGRAPH.
  1785.  
  1786. See also: p_graphresult, p_initgraph, p_registerbgidriver,
  1787. p_registerfarbgifont
  1788.  
  1789. ---------------------------------------------------------------------------
  1790. p_registerfarbgidriver
  1791. int p_registerfarbgidriver(void far *driver);
  1792.  
  1793. This routine differs from p_registerbgidriver in that it allows a far
  1794. pointer as the address of driver, thus allowing drivers to be loaded on the
  1795. far heap.
  1796.  
  1797. See also: p_graphresult, p_initgraph, p_registerbgidriver,
  1798. p_registerfarbgifont
  1799.  
  1800. ---------------------------------------------------------------------------
  1801. p_registerfarbgifont
  1802. int p_registerfarbgifont(void far *font);
  1803.  
  1804. This routine differs from p_registerbgifont in that it allows a far pointer
  1805. as the address of font, thus allowing font to be loaded on the far heap.
  1806.  
  1807. See also: p_graphresult, p_initgraph, p_registerbgifont,
  1808. p_registerfarbgidriver
  1809.  
  1810.  
  1811.  
  1812. Copyright - Frank van der Hulst/1991
  1813. PGRAPH Printer Graphics Library                                    Page 27.
  1814.  
  1815.  
  1816. ---------------------------------------------------------------------------
  1817. p_sector
  1818. void p_sector( int X, int Y, int StAngle, int EndAngle, int XRadius, int
  1819. YRadius);
  1820.  
  1821. Draws an elliptical arc in the current drawing colour, centred at (x,y)
  1822. with the given radii. The arc travels from stangle to endangle, in a
  1823. counterclockwise direction. Lines are drawn from each end of the arc to (x,
  1824. y). The thickness of the lines and arc can be set using the thickness
  1825. parameter of p_setlinestyle. The interior of the sector is filled using the
  1826. current fill pattern and colour.
  1827.  
  1828. This routine allocates memory via _p_graphgetmem, and frees it again
  1829. afterwards via _p_graphfreemem. If the memory is not available, a call to
  1830. p_graphresult will return a value of -6.
  1831.  
  1832. See also: p_ellipse, p_fillellipse, p_getarccoords, p_getaspectratio,
  1833. p_graphresult, p_pieslice, p_setfillstyle
  1834.  
  1835. ---------------------------------------------------------------------------
  1836. p_setaspectratio
  1837. void p_setaspectratio(int xasp, int yasp);
  1838.  
  1839. This is used to change the aspect ratio of the current printer graphics
  1840. mode. The aspect ratio is used by PGRAPH to ensure that circles, circular
  1841. arcs, and pie slices are drawn correctly.
  1842.  
  1843. See also: p_arc, p_circle, p_getaspectratio, p_pieslice
  1844.  
  1845. ---------------------------------------------------------------------------
  1846. p_setcolor
  1847. void p_setcolor(int color);
  1848.  
  1849. Sets the current drawing colour to color, which can range from 0 (white) to
  1850. p_getmaxcolor, which is set to 1 (black).
  1851.  
  1852. The current drawing colour is used whenever pixels are set.
  1853.  
  1854. ---------------------------------------------------------------------------
  1855. p_setfillpattern
  1856. void p_setfillpattern(char far *upattern, int colour);
  1857.  
  1858. Copies the user-defined fill pattern in the 8-byte area pointed to by
  1859. pattern into PGRAPH. This 8 by 8 pattern is tiled across any area being
  1860. filled by p_floodfill, p_fillellipse, p_pieslice, p_sector, or p_fillpoly.
  1861. Whenever a bit in the pattern is set to 1, the corresponding pixel is
  1862. plotted.
  1863.  
  1864. See also: p_bar, p_bar3d, p_fillellipse, p_fillpoly, p_getfillpattern,
  1865. p_getfillsettings, p_pieslice, p_sector
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872. Copyright - Frank van der Hulst/1991
  1873. PGRAPH Printer Graphics Library                                    Page 28.
  1874.  
  1875.  
  1876. ---------------------------------------------------------------------------
  1877. p_setfillstyle
  1878. void p_setfillstyle(int pattern, int colour);
  1879.  
  1880. Sets the current fill pattern and colour. To set a user-defined fill
  1881. pattern, it is better to call p_setfillpattern.
  1882.  
  1883.      Name           Value     Description
  1884.      EMPTY_FILL         0     Fill with background colour (0)
  1885.      SOLID_FILL         1     solid fill
  1886.      LINE_FILL          2     fill with ---
  1887.      LTSLASH_FILL       3     fill with ///
  1888.      SLASH_FILL         4     fill with ///, thick lines
  1889.      BKSLASH_FILL       5     fill with \\\, thick lines
  1890.      LTBKSLASH_FILL     6     fill with \\\
  1891.      HATCH_FILL         7     light hatch fill
  1892.      XHATCH_FILL        8     heavy cross-hatch fill
  1893.      INTERLEAVE_FILL    9     interleaving line fill
  1894.      WIDE_DOT_FILL     10     widely spaced dot fill
  1895.      CLOSE_DOT_FILL    11     closely spaced dot fill
  1896.      USER_FILL         12     user-defined fill pattern
  1897.  
  1898. All but EMPTY_FILL fill with the current colour; EMPTY_FILL uses the
  1899. current background colour (0).
  1900.  
  1901. If invalid input is passed to p_setfillstyle, p_graphresult will return -
  1902. 11, and the current fill settings will remain unchanged.
  1903.  
  1904. See also: p_bar, p_bar3d, p_fillellipse, p_fillpoly, p_setfillpattern,
  1905. p_getfillsettings, p_pieslice, p_sector
  1906.  
  1907. ---------------------------------------------------------------------------
  1908. p_setgraphmode
  1909. void p_setgraphmode(int mode);
  1910.  
  1911. Selects a new graphics mode. mode must be a valid mode for the current
  1912. device driver. Unlike setgraphmode in GRAPHICS.LIB, p_setgraphmode does NOT
  1913. clear the printer buffer, nor reset the graphics settings to their
  1914. defaults.
  1915.  
  1916. See also: p_getgraphmode, p_getmoderange, p_graphresult, p_initgraph
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923.  
  1924.  
  1925.  
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932. Copyright - Frank van der Hulst/1991
  1933. PGRAPH Printer Graphics Library                                    Page 29.
  1934.  
  1935.  
  1936. ---------------------------------------------------------------------------
  1937. p_setlinestyle
  1938. void p_setlinestyle(int linestyle, unsigned upattern, int thickness);
  1939.  
  1940. Sets the current line width and style.
  1941.  
  1942. linestyle specifies which style to use for subsequent lines. If it is
  1943. USERBIT_LINE, then upattern is used, otherwise it is ignored.
  1944.  
  1945.      Name           Value     Description
  1946.      SOLID_LINE         0     solid line
  1947.      DOTTED_LINE        1     dotted line
  1948.      CENTER_LINE        2     centered line
  1949.      DASHED_LINE        3     dashed line
  1950.      USERBIT_LINE       4     user-defined line style
  1951.  
  1952. upattern is a 16-bit pattern ; whenever a bit in the pattern is 1, the
  1953. corresponding pixel in the line is drawn in the current colour.
  1954.  
  1955. thickness specifies how wide lines are to be drawn.
  1956.  
  1957.      Name           Value     Description
  1958.      NORM_WIDTH         1     1 pixel wide
  1959.      THICK_WIDTH        3     3 pixels wide
  1960.  
  1961. If THICK_WIDTH is used, nine pixels (a 3x3 block) are drawn instead of one
  1962. for each point on a line. This has side-effects if p_setwritemode(XOR_PUT)
  1963. has been used.
  1964.  
  1965. If invalid input is passed to p_setlinestyle, p_graphresult will return -
  1966. 11, and the current line settings will remain unchanged.
  1967.  
  1968. See also: p_arc, p_bar3d, p_circle, p_drawpoly, p_ellipse, p_fillellipse,
  1969. p_getlinesettings, p_graphresult, p_line, p_linerel, p_lineto, p_pieslice,
  1970. p_rectangle
  1971.  
  1972. ---------------------------------------------------------------------------
  1973. p_settextjustify
  1974. void p_settextjustify(int horiz, int vert);
  1975.  
  1976. Sets text justification for p_outtext and p_outtextxy. Text will be
  1977. justified round the designated position, as specified. The default settings
  1978. are LEFT_TEXT and TOP_TEXT.
  1979.  
  1980.      Name           Value     Description
  1981.      LEFT_TEXT          0     horizontal
  1982.      CENTER_TEXT        1     horizontal and vertical
  1983.      RIGHT_TEXT         2     horizontal
  1984.      TOP_TEXT           0     vertical
  1985.      BOTTOM_TEXT        2     vertical
  1986.  
  1987. LEFT_TEXT means that text will be left-justified relative to the designated
  1988. position i.e. it will appear to the right of the designated position, etc.
  1989.  
  1990. If invalid input is passed to p_settextjustify, p_graphresult will return -
  1991. 11, and the current text settings will remain unchanged.
  1992.  
  1993. See also: p_gettextsettings, p_graphresult, p_outtext, p_outtextxy,
  1994. p_settextstyle
  1995.  
  1996.  
  1997.  
  1998. Copyright - Frank van der Hulst/1991
  1999. PGRAPH Printer Graphics Library                                    Page 30.
  2000.  
  2001.  
  2002. ---------------------------------------------------------------------------
  2003. p_settextstyle
  2004. void p_settextstyle(int font, int direction, int charsize);
  2005.  
  2006. Sets the font, direction, and size of characters to be output by p_outtext
  2007. and p_outtextxy.
  2008.  
  2009. Fonts available include one bit-mapped font, and several 'stroked' fonts.
  2010.  
  2011.      Name           Value     Filename  Description
  2012.      DEFAULT_FONT       0               8x8 bit-mapped font
  2013.      TRIPLEX_FONT       1     TRIP      Triplex
  2014.      SMALL_FONT         2     LITT      Small
  2015.      SANS_SERIF_FONT    3     SANS      Sans serif
  2016.      GOTHIC_FONT        4     GOTH      Gothic
  2017.      SCRIPT_FONT        5     SCRI      Script
  2018.      SIMPLEX_FONT       6     SIMP      Simplex
  2019.      TRI_SCR_FONT       7     TSCR      Triplex script
  2020.      COMPLEX_FONT       8     COMP      Complex
  2021.      EURO_FONT          9     EURO      Eurostyle
  2022.      BOLD_FONT         10     BOLD      Boldface
  2023.  
  2024. The default bit-mapped font is built into the BIOS of your machine. As
  2025. such, it may vary slightly from one machine to another. It is also probably
  2026. slightly different from that included in GRAPHICS.LIB. You should run the
  2027. GRAFTABL utility provided with DOS before printing any bit-mapped
  2028. characters from the extended ASCII set (i.e. characters whose ASCII value
  2029. is greater than 0x7F).
  2030.  
  2031. Stroked fonts are stored in *.CHR disk files. The first four are
  2032. distributed as part of the Turbo C package, the others are provided by
  2033. Borland and available from various sources. Normally the *.CHR file needs
  2034. to be loaded into memory before it can be used. To avoid this, you can link
  2035. font files into your program. Consult your Turbo C manual on how to do
  2036. this.
  2037.  
  2038. direction: font directions supported are horizontal (left to right) and
  2039. vertical (rotated 90 degrees counterclockwise, bottom to top). The default
  2040. direction is HORIZ_DIR.
  2041.  
  2042.      Name           Value     Description
  2043.      HORIZ_DIR          0     left to right
  2044.      VERT_DIR           1     bottom to top
  2045.  
  2046. The size of text can be magnified using the charsize factor.
  2047.  
  2048.      ValueBit-mapped             Stroked
  2049.          0   Invalid      p_usercharsize
  2050.          1       8x8                 40%
  2051.          2     16x16                 66%
  2052.          3     24x24                 75%
  2053.          4     32x32                100%
  2054.          5     40x40                133%
  2055.          6     48x48                166%
  2056.          7     56x56                200%
  2057.          8     64x64                250%
  2058.          9     72x72                300%
  2059.         10     80x80                400%
  2060.  
  2061.  
  2062. Copyright - Frank van der Hulst/1991
  2063. PGRAPH Printer Graphics Library                                    Page 31.
  2064.  
  2065.  
  2066.  
  2067. p_textheight and p_textwidth should always be used to determine the actual
  2068. dimensions of text.
  2069.  
  2070. See also: p_gettextsettings, p_graphresult, p_settextjustify,
  2071. p_setusercharsize, p_textheight, p_textwidth
  2072.  
  2073. ---------------------------------------------------------------------------
  2074. p_setusercharsize
  2075. void p_setusercharsize(int multx, int divx, int multy, int divy);
  2076.  
  2077. Allows the user to independently control the x and y scaling of text output
  2078. using stroked fonts. The scaling factors are given as a combination of
  2079. multiplier and divider. For example, to set the width to twice normal, and
  2080. the height to 1.5 times normal, use
  2081.  
  2082.      p_setusercharsize(2, 1, 3, 2);
  2083.  
  2084. See also: p_gettextsettings, p_graphresult, p_settextstyle
  2085.  
  2086. ---------------------------------------------------------------------------
  2087. p_setviewport
  2088. void p_setviewport(int left, int top, int right, int bottom, int clip);
  2089.  
  2090. Establishes the size and location of the viewport onto the printed page.
  2091. The viewport's corners are given in absolute pixel coordinates.
  2092.  
  2093. The width of the viewport is rounded up to a multiple of eight pixels.
  2094.  
  2095. The left coordinate is used to set the left edge of the viewport on the
  2096. printed page. The top and bottom coordinates are used only to calculate the
  2097. height of the viewport. They do NOT set the vertical position of the
  2098. viewport on the page. Graphics are always printed at the current cursor
  2099. position, so that a sequence of p_print() commands will print each viewport
  2100. in turn down the page.
  2101.  
  2102. This routine releases the current viewport by calling _p_graphfreemem, then
  2103. allocates memory for the new viewport via _p_graphgetmem. If the memory is
  2104. not available, a call to p_graphresult will return a value of -6.
  2105.  
  2106. Because p_setviewport allocates only enough memory for the selected
  2107. viewport, it is not possible to plot outside the current viewport.
  2108. Therefore, the parameter clip is not used; it was included only to maintain
  2109. similarity with setviewport in GRAPHICS.LIB.
  2110.  
  2111. See also: p_clearviewport, p_getviewsettings, p_graphresult, p_initgraph
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.  
  2122. Copyright - Frank van der Hulst/1991
  2123. PGRAPH Printer Graphics Library                                    Page 32.
  2124.  
  2125.  
  2126. ---------------------------------------------------------------------------
  2127. p_setwritemode
  2128. void p_setwritemode(int mode);
  2129.  
  2130. Sets the writing mode for printer output.
  2131.  
  2132.      Name           Value     Description
  2133.      COPY_PUT           0     Over-write existing pixel
  2134.      XOR_PUT            1     xor with existing pixel
  2135.  
  2136. Two successive XOR puts to the same location will change the pixel at that
  2137. location, then restore it again.
  2138.  
  2139. Note that this is different from setwritemode in GRAPHICS.LIB, which works
  2140. only with line-drawing functions.
  2141.  
  2142. See also: p_putimage
  2143.  
  2144. ---------------------------------------------------------------------------
  2145. p_textheight
  2146. int p_textheight(char far *string);
  2147.  
  2148. Uses the current font size and scaling factor to determine the height of
  2149. string in pixels. It is desirable to use p_textheight to compute the height
  2150. of strings so that code is portable across several fonts and sizes.
  2151.  
  2152. See also: p_gettextsettings, p_outtext, p_outtextxy, p_settextstyle,
  2153. p_textwidth
  2154.  
  2155. ---------------------------------------------------------------------------
  2156. p_textwidth
  2157. int p_textwidth(char far *string);
  2158.  
  2159. Uses the current font size and scaling factor to determine the width of
  2160. string in pixels. It is desirable to use p_textwidth to compute the width
  2161. of strings so that code is portable across several fonts and sizes.
  2162.  
  2163. See also: p_gettextsettings, p_outtext, p_outtextxy, p_settextstyle,
  2164. p_textheight
  2165.  
  2166. ---------------------------------------------------------------------------
  2167. p_view
  2168. void p_view(void);
  2169.  
  2170. Displays the printer buffer on the screen. This is done by calling
  2171. _p_putpixel_screen, which therefore must be defined by the user. This is
  2172. designed as a debugging tool. It is the programmer's responsibility to put
  2173. the system into graphics mode and set the appropriate viewport on the
  2174. screen beforehand, and close down the graphics system afterwards.
  2175.  
  2176. See also: p_dump, _p_putpixel_screen
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182. Copyright - Frank van der Hulst/1991
  2183. PGRAPH Printer Graphics Library                                    Page 33.
  2184.  
  2185.  
  2186. MAKING A .PGI FILE
  2187.  
  2188. MAKE_PGI.EXE is a program to allow the user to create new .PGI files,
  2189. either for a printer for which a .PGI file has not yet been created, or
  2190. else to take advantage of features on an existing printer which are not
  2191. supported by the existing .PGI file.
  2192.  
  2193. Before starting to create a PGI driver, browse through your printer manual,
  2194. looking for information about printing graphics.
  2195.  
  2196. A .PGI file consists of two parts -- a description of the printer, and a
  2197. description of how to print graphics in each of its modes. MAKE_PGI leads
  2198. the user through each of these parts by asking a series of questions.
  2199.  
  2200. Printer Description
  2201.  
  2202. The first question asked is
  2203.  
  2204.      What is your name ?
  2205.  
  2206. Type in your name, or any other string you want, up to a maximum of 127
  2207. characters. This string is used to create the "copyright" message at the
  2208. beginning of the .PGI file. To see what the message looks like, use
  2209.  
  2210.      TYPE LASERJET.PGI
  2211.  
  2212. to see what is contained in the descriptive header of the LaserJet .PGI
  2213. file.
  2214.  
  2215. Next, the program asks
  2216.  
  2217.      What is the printer's name ?
  2218.  
  2219. Type in the name and model number of the printer, up to a total of 20
  2220. characters. This string will be included in the descriptive header of the
  2221. file, and a pointer to this will also be returned by the p_getdrivername
  2222. function.
  2223.  
  2224. Next, the program asks
  2225.  
  2226.      What printer ID number ?
  2227.  
  2228. You may enter a number in the range 1 to 5. This will be the number used to
  2229. select the driver when p_initgraph is called. Note that each driver
  2230. registered must have a unique ID number. For example, if you create a
  2231. driver called STAR2 with an ID number of 1, you cannot register both STAR
  2232. and STAR2. Note also that PGRAPH searches only for those files it knows
  2233. about when an unregistered driver is used, so that if you create STAR2, but
  2234. do not register it via either p_registerbgidriver or
  2235. p_registerfarbgidriver, then a call to p_initgraph will look for STAR.PGI
  2236. on the disk.
  2237.  
  2238. Next, the program asks
  2239.  
  2240.      Are numbers sent to your printer in ASCII (Y/N) ?
  2241.  
  2242. Most dot-matrix printers require the number of graphics bytes to be printed
  2243. to be sent as a 2-byte (16-bit) binary number. The HP LaserJet requires
  2244.  
  2245.  
  2246. Copyright - Frank van der Hulst/1991
  2247. PGRAPH Printer Graphics Library                                    Page 34.
  2248.  
  2249.  
  2250. that the number of bytes be sent as the ASCII representation of the number.
  2251. For example, to print 375 bytes, the LaserJet requires the characters '3',
  2252. '7', and '5' be sent to it, whereas the Star requires the bytes 77 01 (w)
  2253. be sent to it.
  2254.  
  2255. Press Y or N, depending on what your printer requires.
  2256.  
  2257. The last piece of information required is how to return from graphics mode
  2258. to text mode on the printer. The program will ask
  2259.  
  2260.      What string do you use to end graphics on your printer ?
  2261.  
  2262. You should type in a series of up to 20 characters, as described in your
  2263. printer manual, to return from graphics mode to text mode. At the end of
  2264. the string, press the F10 function key. Note that if you make a mistake,
  2265. you CANNOT use the backspace key to go back and fix the error -- you will
  2266. have to start the MAKE_PGI program over again.
  2267.  
  2268. Examples:
  2269.  
  2270. STAR NX-10 9-pin dot-matrix printer
  2271.  
  2272.      What is your name ? F van der Hulst
  2273.      What is the printer's name ? Star NX-10
  2274.      What printer ID number ? 1
  2275.      Are numbers sent to your printer in ASCII (Y/N) ? N
  2276.      What string do you use to end graphics on your printer ?
  2277.      ^[A^I^[2                                        ESC A Ctrl-I ESC 2 F10
  2278.  
  2279. This last command sets line spacing back to 9/72 inch, since the various
  2280. graphics modes alter the line spacing.
  2281.  
  2282. HP LaserJet laser printer
  2283.  
  2284.      What is your name ? F van der Hulst
  2285.      What is the printer's name ? LaserJet
  2286.      What printer ID number ? 2
  2287.      Are numbers sent to your printer in ASCII (Y/N) ? Y
  2288.      What string do you use to end graphics on your printer ?
  2289.      ^[*r0B^M                                        ESC * r 0 B Ctrl-M F10
  2290.  
  2291. This restores the printer to text mode, and issues a Carriage Return to
  2292. start text at the left-hand side of the page.
  2293.  
  2294.  
  2295. Graphics Modes Descriptions
  2296.  
  2297. Once the overall printer description has been done, you need to describe
  2298. how graphics is printed in each graphics modes in turn.
  2299.  
  2300. For each mode, answer the following questions:
  2301.  
  2302.      X resolution ?
  2303.  
  2304. The number of dots per inch in X resolution.
  2305.  
  2306.      Y resolution ?
  2307.  
  2308.  
  2309. Copyright - Frank van der Hulst/1991
  2310. PGRAPH Printer Graphics Library                                    Page 35.
  2311.  
  2312.  
  2313.  
  2314. The number of dots per inch in Y resolution.
  2315.  
  2316.      X bits per pass ?
  2317.  
  2318. This is a number, either 1 or 8, which shows how many horizontal pixels are
  2319. sent in one byte. On a LaserJet, this is 8; on dot-matrix printers, it is
  2320. 1.
  2321.  
  2322.      Y bits per pass ?
  2323.  
  2324. This is a number, either 1 or 8, which shows how many rows of pixels are
  2325. sent in one byte. On a LaserJet, this is 1; on dot-matrix printers, it is 1
  2326. or 8: 8 bits forces a vertical resolution the same as the vertical pin
  2327. spacing, whereas 1 pixel-row at a time allows a different vertical
  2328. resolution to be used.
  2329.  
  2330.      What is the mode's name ?
  2331.  
  2332. Type in the name of the mode (usually the graphics resolution), up to a
  2333. total of 20 characters. A pointer to this string will be returned by the
  2334. p_getmodename function.
  2335.  
  2336.      What string do you use to start this graphics mode on your printer
  2337.  
  2338. Type in a series of up to 20 characters, as described in your printer
  2339. manual, to start the graphics mode. This string will be sent once, at the
  2340. beginning of p_print. At the end of the string, press the F10 function key.
  2341. Note that if you make a mistake, you CANNOT use the backspace key to go
  2342. back and fix the error -- you will have to re-enter the mode again.
  2343.  
  2344.  
  2345. A line of graphics consists of several parts:
  2346.      A string of characters
  2347.      The number of graphics bytes to be sent (ASCII/Binary)
  2348.      A string of characters
  2349.      Graphics bytes
  2350.      A string of characters
  2351.  
  2352. You need to specify each of the strings of characters for each mode, by
  2353. answering the following questions:
  2354.  
  2355.      What string precedes the number in this mode ?
  2356.      What string follows the number in this mode ?
  2357.      What string ends a line of graphics in this mode ?
  2358.  
  2359. Note that entry of each of these strings is similar to entry of the "start
  2360. graphics mode" string:
  2361.      Press F10 to terminate entry
  2362.      You cannot correct any errors
  2363.      Maximum of 20 characters
  2364.  
  2365.  
  2366. That concludes entry of the information on a graphics mode. After each
  2367. mode, the program will ask if it is correct:
  2368.  
  2369.      Is this mode OK (Y/N) ?
  2370.  
  2371.  
  2372. Copyright - Frank van der Hulst/1991
  2373. PGRAPH Printer Graphics Library                                    Page 36.
  2374.  
  2375.  
  2376.  
  2377. If you made a mistake, press N and then re-enter it. If everything was
  2378. entered correctly, press Y.
  2379.  
  2380. Finally, the program will ask:
  2381.  
  2382.      Add another mode (Y/N) ?
  2383.  
  2384. If you press N, that will terminate entry of the driver data and the
  2385. program will write the data entered to USER.PGI -- you should rename it to
  2386. the correct filename.
  2387.  
  2388.  
  2389. Examples:
  2390.  
  2391. STAR NX-10 9-pin dot-matrix printer
  2392.  
  2393. Mode 0:
  2394.  
  2395.      X resolution ? 60
  2396.      Y resolution ? 72
  2397.      X bits per pass ? 1
  2398.      Y bits per pass ? 8
  2399.      What is the mode's name ? 60 * 72
  2400.      What string do you use to start this graphics mode on your printer
  2401.      ^[3^X                                                 ESC 3 Ctrl-X F10
  2402.      What string precedes the number in this mode ?
  2403.      ^[K                                                          ESC K F10
  2404.      What string follows the number in this mode ?
  2405.                                                                         F10
  2406.      What string ends a line of graphics in this mode ?
  2407.      ^M^J                                                 Ctrl-M Ctrl-J F10
  2408.      Is this mode OK (Y/N) ? Y
  2409.      Add another mode (Y/N) ? Y
  2410.  
  2411.  
  2412. Mode 1:
  2413.  
  2414.      X resolution ? 120
  2415.      Y resolution ? 216
  2416.      X bits per pass ? 1
  2417.      Y bits per pass ? 1
  2418.      What is the mode's name ? 120 * 216
  2419.      What string do you use to start this graphics mode on your printer
  2420.      ^[3^A                                                 ESC 3 Ctrl-A F10
  2421.      What string precedes the number in this mode ?
  2422.      ^[L                                                          ESC L F10
  2423.      What string follows the number in this mode ?
  2424.                                                                         F10
  2425.      What string ends a line of graphics in this mode ?
  2426.      ^M^J                                                 Ctrl-M Ctrl-J F10
  2427.      Is this mode OK (Y/N) ? Y
  2428.      Add another mode (Y/N) ? Y
  2429.  
  2430. Continue this process for the remaining 6 modes.
  2431.  
  2432. Notes:
  2433.  
  2434.  
  2435. Copyright - Frank van der Hulst/1991
  2436. PGRAPH Printer Graphics Library                                    Page 37.
  2437.  
  2438.  
  2439.  
  2440.      The "start graphics string" sets the linefeed spacing to the correct
  2441.      number of 1/216 of an inch, the minimum unit of Y spacing on the Star
  2442.      printer. In mode 0, this is 24/216, which equals 8/72 (8 rows of
  2443.      pixels are printed at a time). In mode 1, this 1/216, and only one row
  2444.      of pixels is printed at a time. A CR-LF pair at the end of each line
  2445.      is used to advance the printer.
  2446.  
  2447.      No string of characters is sent after the number of bytes, and the
  2448.      data bytes.
  2449.  
  2450.  
  2451. HP LaserJet laser printer
  2452.  
  2453. Mode 0:
  2454.  
  2455.      X resolution ? 75
  2456.      Y resolution ? 75
  2457.      X bits per pass ? 8
  2458.      Y bits per pass ? 1
  2459.      What is the mode's name ? 75 * 75
  2460.      What string do you use to start this graphics mode on your printer
  2461.      ^[&s1C^[9^[*t75R^[*r1A ESC & s 1 C ESC 9 ESC * t 7 5 R ESC * r 1 A F10
  2462.      What string precedes the number in this mode ?
  2463.      ^[*b                                                       ESC * b F10
  2464.      What string follows the number in this mode ?
  2465.      W                                                                W F10
  2466.      What string ends a line of graphics in this mode ?
  2467.                                                                         F10
  2468.      Is this mode OK (Y/N) ? Y
  2469.      Add another mode (Y/N) ? Y
  2470.  
  2471.  
  2472. Mode 1:
  2473.  
  2474.      X resolution ? 100
  2475.      Y resolution ? 100
  2476.      X bits per pass ? 8
  2477.      Y bits per pass ? 1
  2478.      What is the mode's name ? 100 * 100
  2479.      What string do you use to start this graphics mode on your printer
  2480.      ^[&s1C^[9^[*t100R^[*r1A ESC & s 1 C ESC 9 ESC * t 1 0 0 R ESC * r 1 A
  2481. F10
  2482.      What string precedes the number in this mode ?
  2483.      ^[*b                                                       ESC * b F10
  2484.      What string follows the number in this mode ?
  2485.      W                                                                W F10
  2486.      What string ends a line of graphics in this mode ?
  2487.                                                                         F10
  2488.      Is this mode OK (Y/N) ? Y
  2489.      Add another mode (Y/N) ? Y
  2490.  
  2491.  
  2492. Continue this process for the remaining 2 modes.
  2493.  
  2494. Notes:
  2495.      The "start graphics string" sets the graphics mode.
  2496.  
  2497.  
  2498. Copyright - Frank van der Hulst/1991
  2499. PGRAPH Printer Graphics Library                                    Page 38.
  2500.  
  2501.  
  2502.  
  2503.      The printer automatically advances at the end of each line, so no
  2504.      string of characters is sent at the end of each line.
  2505.  
  2506.  
  2507. REVISION HISTORY
  2508.  
  2509. Version        Released       Comments
  2510.  
  2511. 1.00           01 Apr 91      Turbo C only, pre-release
  2512. 1.01           15 Apr 91      Added MS C support.
  2513.                               Minor change to p_registerfarbgidriver
  2514. 1.10           19 Jun 91      Support for all memory models.
  2515.                               p_print parameter is handle, not FILE*
  2516.                               Serialisation removed
  2517.  
  2518.  
  2519.  
  2520.  
  2521.  
  2522.  
  2523.  
  2524.  
  2525.  
  2526.  
  2527.  
  2528.  
  2529.  
  2530.  
  2531.  
  2532.  
  2533.  
  2534.  
  2535.  
  2536.  
  2537.  
  2538.  
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558. Copyright - Frank van der Hulst/1991
  2559. PGRAPH Printer Graphics Library                                    Page 39.
  2560.  
  2561.  
  2562.                                    Index
  2563.  
  2564.  
  2565. DISCLAIMER.................................................................4
  2566. Graphics Modes Descriptions...............................................34
  2567. Index.....................................................................39
  2568. Introduction...............................................................1
  2569. Limitations and variations from GRAPHICS.LIB...............................9
  2570. MAKING A .PGI FILE........................................................33
  2571. Minimal Program Size.......................................................5
  2572. Networks...................................................................5
  2573. PGRAPH Features............................................................5
  2574. PGRAPH Files...............................................................6
  2575. PGRAPH Function Reference.................................................11
  2576. PGRAPH License Agreement...................................................2
  2577. Planned Improvements.......................................................5
  2578. Printer Description.......................................................33
  2579. Printer Support............................................................5
  2580. p_arc.....................................................................12
  2581. p_bar.....................................................................12
  2582. p_bar3d...................................................................12
  2583. p_circle..................................................................13
  2584. p_cleardevice.............................................................13
  2585. p_clearviewport...........................................................13
  2586. p_closegraph..............................................................13
  2587. p_drawpoly................................................................14
  2588. p_dump....................................................................14
  2589. p_ellipse.................................................................14
  2590. p_fillellipse.............................................................14
  2591. p_fillpoly................................................................15
  2592. p_floodfill...............................................................15
  2593. p_getarccoords............................................................15
  2594. p_getaspectratio..........................................................15
  2595. p_getcolor................................................................16
  2596. p_getdrivername...........................................................16
  2597. p_getfillpattern..........................................................16
  2598. p_getfillsettings.........................................................16
  2599. p_getgraphmode............................................................16
  2600. p_getimage................................................................17
  2601. p_getlinesettings.........................................................17
  2602. p_getmaxcolor.............................................................17
  2603. p_getmaxmode..............................................................17
  2604. p_getmaxx.................................................................17
  2605. p_getmaxy.................................................................17
  2606. p_getmodename.............................................................18
  2607. p_getmoderange............................................................18
  2608. p_getpixel................................................................18
  2609. p_getresolution...........................................................18
  2610. p_gettextsettings.........................................................18
  2611. p_getx....................................................................18
  2612. p_gety....................................................................19
  2613. p_graphdefaults...........................................................19
  2614. p_graphresult.............................................................20
  2615. p_imagesize...............................................................21
  2616. p_initgraph...............................................................21
  2617. p_line....................................................................22
  2618. p_linerel.................................................................22
  2619.  
  2620.  
  2621. Copyright - Frank van der Hulst/1991
  2622. PGRAPH Printer Graphics Library                                    Page 40.
  2623.  
  2624.  
  2625. p_lineto..................................................................22
  2626. p_moverel.................................................................23
  2627. p_moveto..................................................................23
  2628. p_outtext.................................................................23
  2629. p_outtextxy...............................................................23
  2630. p_pieslice................................................................23
  2631. p_print...................................................................24
  2632. p_putimage................................................................24
  2633. p_putpixel................................................................25
  2634. p_rectangle...............................................................25
  2635. p_registerbgidriver.......................................................26
  2636. p_registerbgifont.........................................................26
  2637. p_registerfarbgidriver....................................................26
  2638. p_registerfarbgifont......................................................26
  2639. p_sector..................................................................27
  2640. p_setaspectratio..........................................................27
  2641. p_setcolor................................................................27
  2642. p_setfillpattern..........................................................27
  2643. p_setfillstyle............................................................28
  2644. p_setgraphmode............................................................28
  2645. p_setlinestyle............................................................29
  2646. p_settextjustify..........................................................29
  2647. p_settextstyle............................................................30
  2648. p_setusercharsize.........................................................31
  2649. p_setviewport.............................................................31
  2650. p_setwritemode............................................................32
  2651. p_textheight..............................................................32
  2652. p_textwidth...............................................................32
  2653. p_view....................................................................32
  2654. Registered Version:........................................................3
  2655. Registration Information...................................................1
  2656. REVISION HISTORY..........................................................38
  2657. Shareware Version:.........................................................2
  2658. Source Code Version:.......................................................3
  2659. Technical Support..........................................................4
  2660. Test Driving PGRAPH........................................................7
  2661. Using PGRAPH in your own programs..........................................8
  2662. Video Support..............................................................5
  2663. _p_graphfreemem...........................................................19
  2664. _p_graphgetmem............................................................20
  2665. _p_putpixel_screen........................................................25
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677. Copyright - Frank van der Hulst/1991
  2678.  
  2679.